-
Notifications
You must be signed in to change notification settings - Fork 753
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
Support Google Tag Manager Data Layer #2657
Conversation
…ientlib to ensure backwards compatibility
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2657 +/- ##
=========================================
Coverage 87.32% 87.33%
- Complexity 2655 2659 +4
=========================================
Files 232 232
Lines 7100 7105 +5
Branches 1081 1082 +1
=========================================
+ Hits 6200 6205 +5
Misses 357 357
Partials 543 543 ☔ View full report in Codecov by Sentry. |
...ent/jcr_root/apps/core/wcm/components/accordion/v1/accordion/clientlibs/site/js/accordion.js
Outdated
Show resolved
Hide resolved
...ent/jcr_root/apps/core/wcm/components/accordion/v1/accordion/clientlibs/site/js/accordion.js
Outdated
Show resolved
Hide resolved
@brobatr , could you please add verification instructions for this enhancement? |
hi @LSantha just to check what you would like. Do you mean to test that the datalayer renaming works? Or is it related to testing whether Google Tag Manager will consume the data layer correctly and push(stuff) will work OK? |
@brobatr, in principle both but most importantly the later. |
hi @LSantha, I hope this is quick and painless - it should not take more than 15 mins: Go to https://tagmanager.google.com/ and add a new account including a web container Under admin (top menu) choose import container and import the JSON below (options: existing, overwrite). This just catches events and has a couple of test variables. Then Admin->Install Google Tag Manager . This contains the script snippets needed in a page and where to put them. Edit the CC Page component head.html add add the header snippet before the closing template tag in CRX DE as described. You can ignore the noscript one for the body. In conf enable the data layer, change the name to dataLayer and disable the ACDL as described in the CC Datalayer docu included in the PR Open a page in AEM for example http://localhost:4502/content/wknd/us/en/about-us.html?wcmmode=disabled Install Google Tag Assistant Chrome extension: https://chromewebstore.google.com/detail/tag-assistant-companion/jmekfmbnaedfebfnmakmokmlfpblbfdm Click on the blue Tag Assistant icon in the plugins area in Chrome and create a new domain with the URL of the AEM page you’re testing. In the Chrome tabs a Google debug tab will open and should show something like this: Working from the last event and message from the bottom up you can check: the build of the data layer contents cmp:show is monitored so a carousel change will also show in the debugger: cmp:click on the main nav (page unload can be stopped by
Accordian: http://localhost:4502/content/wknd/language-masters/en/faqs.html Of course if you would like more or there are any issues please let me know Rob |
Quality Gate passedIssues Measures |
Hello @brobatr , thank you for the verification instructions and for your contribution. I could follow the steps and see the new features in action. It will be available in the upcoming release. |
See discussion #2565
The PR allows renaming of the Data Layer. Together with the bugfix #2620 (previously merged) this allows a generic data layer to be configured, i.e. remove ACDL, rename, without making a breaking change. If GTM code is on the page and the Data Layer name is changed to the Google default name of dataLayer, the array will be consumed and extended by GTM thus creating a Google Event-Driven Data Layer. The GDL push() method is available and very similar to that of the ACDL, so all related logic remains the same as before.
Note that support for GTag, the Google global tag, has not been included despite some earlier discussion. This would have been an experimental feature and a significantly more complex implementation. This could be a future enhancement.
The screenshot below shows the Core Component Data Layer used be Google Tag Manager, with a Google event ID and normal OOTB GTM gtm.start timing event added as normal by GTM.