-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Analytics setup/settings logic to determine Google Tag settings #6081
Comments
Looks good to me, I think this approach works 👍🏻 IB ✅ |
…settings Enhance/#6081 analytics gte tag settings
QA Update
|
@mohitwp Nice catch. I think we've implemented it here but a QA:Eng pass would remove all doubt. So, feel free to add the label and proceed accordingly! Cheers. |
QA Update ✅
Assigning QA:eng after discussion with @kuasha420 . AC have some technical points which require confirmation from QA:eng |
QA Eng ✅
|
With the new Google Tag logic in place, the Analytics module now needs to determine the Google Tag ID to use whenever the GA4 web data stream / measurement ID changes. Concretely, this could be the case in the module setup, or settings, or the GA4 activation banner logic.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
If the
gteSupport
feature flag is enabled:modules/analytics-4
store (concretely, thewebDataStreamID
andmeasurementID
settings), logic should run to populate the corresponding Google Tag data:getGoogleTagContainer( measurementID )
selector from Implement Google Tag container lookup and destinations list JS selectors #6079 should be used to identify the Google tag container.Analytics_4
module #6077 which introduced these settings):accountId
andcontainerId
fields on the object should be stored asgoogleTagAccountID
andgoogleTagContainerID
respectively.googleTagID
setting, the following logic should be used (based on thetagIds
field):tagIds
list contains any tag starting in "GT-", use that one. (If there are multiple "GT-" tags, use any one, e.g. the first one.)Analytics_4::handle_provisioning_callback()
) where the new web data stream is being created.Implementation Brief
Note, taking the direction from the AC to implemented a REST data point to share logic, this IB does not make use of the
getGoogleTagContainer
, rather the container lookup is performed on the server side via the REST data point.Within
includes/Modules/Analytics_4.php
:get_google_tag_settings_for_measurement_id
.$measurement_id
parameter.googleTagAccountID
andgoogleTagContainerID
with the values of the container fieldsaccountId
andcontainerId
.googleTagID
key on this array with the value according to the logic detailed in the AC.GET:google-tag-settings
.measurementID
parameter in the request payload.get_google_tag_settings_for_measurement_id
with the measurement ID and return the result.gteSupport
feature flag is enabled:handle_provisioning_callback
method, callget_google_tag_settings_for_measurement_id
with the web data stream's measurement ID and merge the result into the module settings.Within
assets/js/modules/analytics-4/datastore/properties.js
:getGoogleTagSettings
for the newGET:google-tag-settings
data point.*updateSettingsForMeasurementID
.measurementID
parameter.setMeasurementID
with the passedmeasurementID
.gteSupport
feature flag is enabled:measurementID
is empty dispatchsetGoogleTagAccountID
,setGoogleTagContainerID
andsetGoogleTagID
with empty strings and return.fetchGetGoogleTagSettings
, wait for the result, and on success dispatchsetGoogleTagAccountID
,setGoogleTagContainerID
andsetGoogleTagID
with the respective properties of the result.Across the codebase:
setMeasurementID
. At present these are in the following files and all are suitable candidates for replacing withupdateSettingsForMeasurementID
.assets/js/modules/analytics/components/common/PropertySelectIncludingGA4.js
assets/js/modules/analytics/components/settings/GA4SettingsControls.js
assets/js/modules/analytics-4/datastore/properties.js
assets/js/modules/analytics-4/datastore/settings.js
setMeasurementID
call:updateSettingsForMeasurementID
.Test Coverage
QA Brief
gteSupport
feature flag is not enabled in the following areas of the pluggin:gteSupport
feature flag enabled:Changelog entry
The text was updated successfully, but these errors were encountered: