Implement Google Tag container lookup and destinations list JS selectors #6079
Labels
Module: Analytics
Google Analytics module related issues
P0
High priority
Rollover
Issues which role over to the next sprint
Type: Enhancement
Improvement of an existing feature
JS selectors to access the REST data points added in #6078 should be added to the
analytics-4
store.Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
modules/analytics-4
store should receive a new selectorgetGoogleTagContainer( measurementID )
.GET:container-lookup
endpoint implemented in Implement Google Tag container lookup and destinations list REST data points #6078.modules/analytics-4
store should receive a new selectorgetGoogleTagContainerDestinations( gtmAccountID, gtmContainerID )
.GET:container-destinations
endpoint implemented in Implement Google Tag container lookup and destinations list REST data points #6078.Implementation Brief
Create a new file,
containers.js
inassets/js/modules/analytics-4/datastore
with the following:Creating Fetch stores
GET:container-lookup
using thecreateFetchStore
function with the following details:baseName
:getGoogleTagContainer
controlCallback
: receives themeasurementID
and returns theAPI.get()
method that calls thecontainer-lookup
endpoint and passes themeasurementID
.reducerCallback
: receivesstate
andcontainer
(API response) and returns thecontainer
along with the existing state.validateParams
: validates themeasurementID
is not empty.GET:container-destinations
using thecreateFetchStore
function with the following details:baseName
:getGoogleTagContainerDestinations
.controlCallback
: receives thegtmAccountID
andgtmContainerID
and returns theAPI.get()
method that calls thecontainer-destinations
endpoint and passes thegtmAccountID
andgtmContainerID
.reducerCallback
: receivesstate
andcontainerDestinations
list (API response) and returns thecontainerDestinations
along with the existing state.validateParams
: validates thegtmAccountID
andgtmContainerID
are not empty.baseInitialState
should havecontainer
andcontainerDestinations
initialized toundefined
.Creating Resolvers
getGoogleTagContainer
with the following:measurementID
as a parameter.measurementID
is empty.container
.fetchGetGoogleTagContainer
action with themeasurementID
parameter passed.getGoogleTagContainerDestinations
with the following:gtmAccountID
andgtmContainerID
as parameters.gtmAccountID
orgtmContainerID
is empty.containerDestinations
.fetchGetGoogleTagContainerDestinations
action with thegtmAccountID
andgtmContainerID
parameters passed.Creating Selectors
getGoogleTagContainer
with the following:state
as a parameter.container
from the state.getGoogleTagContainerDestinations
with the following:state
as a parameter.containerDestinations
from the state.Data.combineStores()
and export it as we do in other partial data stores.assets/js/modules/analytics-4/datastore/index.js
, import thecontainers.js
and pass it toData.combineStores()
.Analytics_4::create_data_request
method receives an optional parameterdestinationID
. So make it a required parameter and change it tomeasurementID
if it wasdestinationID
.Test Coverage
getGoogleTagContainer
andgetGoogleTagContainerDestinations
selectors.QA Brief
gteSupport
feature flag is available.getGoogleTagContainer
selector from the browser console and verify it returns the container object if available.G-2C8N8YQ1L7
with yourmeasurementID
(destinationID
). It can be obtained from the GTM console.getGoogleTagContainerDestinations
endpoint from the browser console and verify it returns the destination array if available. Otherwise an empty array.accountID
andcontainerID
with the response from thegetGoogleTagContainer
selector. See:Changelog entry
The text was updated successfully, but these errors were encountered: