-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: add martech plugin to connect to analytics and target #153
base: main
Are you sure you want to change the base?
Conversation
Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
|
@fe-lix- @ekremney @bohnertchris Since I did quite some heavy |
@ramboz it has been almost 1 year since the custom analytics events were implemented for this project. I am afraid I cannot recall all the details. The most important events were tracked by GA4 via |
git-subtree-dir: plugins/martech git-subtree-split: 53c20e8bc93f522787e0eb02b182c50c490b318b
@@ -246,123 +245,15 @@ async function loadEager(doc) { | |||
|
|||
const main = doc.querySelector('main'); | |||
if (main) { | |||
createInlineScript(document, document.body, getAlloyInitScript(), 'text/javascript'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled by the martech lib
@@ -246,123 +245,15 @@ async function loadEager(doc) { | |||
|
|||
const main = doc.querySelector('main'); | |||
if (main) { | |||
createInlineScript(document, document.body, getAlloyInitScript(), 'text/javascript'); | |||
createInlineScript(document, document.body, getGTMInitScript(), 'text/javascript'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to the martech loader script
} | ||
} | ||
|
||
async function initializeConversionTracking() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to the martech loader script
sampleRUM('lazy'); | ||
sampleRUM.observe(main.querySelectorAll('div[data-block-name]')); | ||
sampleRUM.observe(main.querySelectorAll('picture > img')); | ||
|
||
await setupAnalyticsTrackingWithAlloy(document); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled by the martech lib
sampleRUM('lazy'); | ||
sampleRUM.observe(main.querySelectorAll('div[data-block-name]')); | ||
sampleRUM.observe(main.querySelectorAll('picture > img')); | ||
|
||
await setupAnalyticsTrackingWithAlloy(document); | ||
await setupAnalyticsTrackingWithGTM(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to matech loader script
This PR adds integration with Target, Launch & ACDL via the martech library. It also moves the Analytics instrumentation to the martech library, and creates a more generic loader to combine the GTM and WebSDK logic and isolate it from the main
scripts.js
file.At a high level:
lib-analytics.js
is renamed tolib-martech-loaded.js
*.petwatch.com
=> prod*.live
/*.page
urls => stagetrackAnalyticsEvent
method is exported to specifically track events in Analytics instead of GTMplugins/martech
head.html
gets new preload/preconnect links for resources immediately imported, so we don't have to wait forscripts.js
to be parsed.Test URLs: