hey guys,
I have been given a script for google tag manager and been asked to test it.
I know its supposed to be injected into the <head></head>
I was reviewing the prev question on this thread at https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager-assets/adding-gtm-on-aem-a...
They have the below approaches -
Is there any other way and what is the expected output when the script is included in the page?
Solved! Go to Solution.
Views
Replies
Total Likes
@NageshRaja Once the script is added into the HEAD , it will show up in the source html code as well as in the network tab. you should see something like a gtm.js show up in the network tab.
@NageshRaja Once the script is added into the HEAD , it will show up in the source html code as well as in the network tab. you should see something like a gtm.js show up in the network tab.
Hi,
The link you are referencing is for AEM Assets, so the methods you listed are uncommon if you are using AEM Sites with an authoring experience. Instead, the most common way to include any script in the <head>
is by modifying the page component from which all templates inherit. In the page component, there could be several places where a developer could add the GTM script, in the below screenshot you can see in RED some of those areas:
The expected output is that the script tag appears in the <head>
of your HTML. Therefore, if you inspect your page and look at the <head>
tag, you should find the GTM script.
Something like this:
<head>
<title>Your Page Title</title>
<script async src="https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXX"></script>
</head>
Once the script is in the HTML, there is a call that will happen and can be reviewed in the Network tab as explained by @Harwinder-singh
Hope this helps
Views
Likes
Replies