Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Adding GTM on AEM authoring environment

Avatar

Avatar
Validate 1
Level 1
Keerthi97
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Keerthi97
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
Keerthi97
Level 1

27-05-2021

Hi All,

Could you please let me know the steps to implement the google analytics on AEM authoring environment with GTM script  which can track all events on AEM. Kindly let me know your thoughts. Also, please let me know any common file on AEM to configure GA.

 

Thanks in Advance! 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Ignite 3
Level 5
davidjgonzalezzzz
Level 5

Likes

68 likes

Total Posts

77 posts

Correct Reply

31 solutions
Top badges earned
Ignite 3
Affirm 25
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Ignite 3
Level 5
davidjgonzalezzzz
Level 5

Likes

68 likes

Total Posts

77 posts

Correct Reply

31 solutions
Top badges earned
Ignite 3
Affirm 25
Ignite 1
Give Back 5
Give Back 3
View profile
davidjgonzalezzzz
Level 5

27-05-2021

EDIT: I just realized you werent asking about AEM Sites .. im in the Assets community afterall!! 

 

There isn't a natural hook to at GTM to the AEM Assets *authoring* experience. I think you would have to either:

 

1) Try to find all an OOTB clientlib category that is loaded "everywhere" in the authoring experience, make your own clientlib w/ a JS that includes your GTM snippet, and mark that clientlib with that ubiquitous clientlib category. That way your GTM would get pulled in whenever the product pulls in that clientlib. That said, its hard to tell where in the page load lifecycle that would get pulled in.

 

2) I believe you could write a Sling Pipeline Transformer that injects your GTM script tag into the <head> tag, though i've never tried this before (ive only ever modified  attributes of existing HTML elements)

 

3) Technically you could write a Sling Filter that injects this on all HTML requests, but this has a number of downsides and is quite intrusive.

 

Long and short is there isn't a good pattern to do this.

 

 

--- 

ORIGINAL RESPONSE ->  The following would be for an AEM Sites web site

Is there any reason you can't use Adobe Launch to include Google Analytics extension? If that is possible, that is recommended since AEM + Launch integration is OOTB.

 

If you cannot, then I would overlay your base page components' /apps/my-site/components/.../page.../customheaderlibs.html and add your GTM tag in there.

Answers (0)