Open rwcsrichardspencer opened 4 weeks ago
Generally speaking we have full control over what, where and when we we add something. We just have to be cautious to not completely destroy our good performance scores with slow analytic scripts. Golden rule here is too keep it to a minimum. Where ever possible we'll only add the scripts after the LCP is loaded to not delay site rendering. We can just use the delayed.js
for this purpose and everything else is just basic JS. An example to add the GTM script within the delayed.js
:
const GTM_SCRIPT = `
window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}
gtag('set', 'linker', {"domains":["www.example.com"]} );
gtag("js", new Date());
gtag("set", "developer_id.<id>", true);
gtag("config", "<id>");
`;
function loadGTM() {
const tag = document.createElement('script');
tag.type = 'text/javascript';
tag.async = true;
tag.id = 'google-gtagjs-js';
tag.src = 'https://www.googletagmanager.com/gtag/js?id=<id>';
document.querySelector('head').append(tag);
const script = document.createElement('script');
script.type = 'text/javascript';
script.id = 'google_gtagjs-js-after';
script.innerHTML = GTM_SCRIPT;
tag.insertAdjacentElement('afterend', script);
}
@rwcsrichardspencer Just to capture it here as well: Your current setup involves Adobe Launch adding the Google Tag Manager Scripts to the pages and GTM running all your analytics?
The big question right now would be if you actually only use Adobe Launch for injecting GTM. From what I've read it's highly discouraged to fully integrate Launch into your EDS site. It would drop your performance scores by about 20-40 points. AFAIK GTM can also be integrated without Adobe Launch (s. previous comment).
There are experimental integrations for the Adobe MarTech stack available, but we shouldn't integrate those if they are not really needed here. Part of the EDS journey is also to cut down your tech- (and especially analytic-) stack to boost performance. So my ask for you (and your team) is to evaluate what analytic tools and what features of those tools you are currently using and if they are actually needed.
Here is some additional documentation on the adobe martech integration for future reference:
But as I said before, I would really advice to only go that route if it's actually needed.
Furthermore, the site already comes with RUM instrumentation as a form of analytics:
This might already serve some of your analytics needs that would otherwise be done by different tools.
@ericvangeem could use some insight into how the current set up is. @kronnox although you mention these analytics tools built-into EDS, we need the site working like for like, including our Adobe Analytics and Google Analytics.
@rwcsrichardspencer Current site uses Adobe's Tag Manager (Launch) to deploy GTM container script as well as Adobe Analytics, all tags and collection rules are defined in Launch.
The current site uses many of Adobe's Core Components which have data layers built into them and can be seen by opening browser dev tools and inspecting the adobeDataLayer
object provided by the Adobe Client Data Layer library.
I scanned the codebase and found a few instances where our component code is pushing to a window.digitalData
object which is presumably being read by either GA or AA. I can share the code for those components in Slack if that's helpful
With the site nearing completion, we'll need to integrate our tracking, analytics and other scripts. Where/how do we manage these scripts? Are they inserted into the
of the HTML? Do we have flexibility in the placement of these scripts? (such as footer if needed). Putting this here for tracking and knowledge sharing on how it will be set up. @dkuntze @MarquiseRosier