Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Integrate Google Analytics in AEM website

Avatar

Level 3

Hi All, 

 

We are developing AEM website (AEM cloud version) and want to integrate Google Analytics with it. I tried to go through Adobe documents/links and some questions on this forum, but all the links have expired and there is no concrete information around best practices. I am looking more into integrating GTM script on the website. Does anyone have an idea? I would really appreciate your help.

 

Thank you

 

Regards,

Rupal

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

There are no one-size-fits-all best practices because everything is scenario-based; there is no universal rule. It depends on several factors, such as the version of AEM, available products, and how the code is structured.

My personal preference, if available, is to integrate Google Analytics through Adobe Launch, which is a straightforward and seamless process. You can find a helpful document explaining how to do this here: https://www.bounteous.com/insights/2019/10/03/implementing-google-analytics-adobe-launch. If you don't have Adobe Launch available, you can simply add the "script" tag from Google Analytics to your head tag (template).

I hope this helps!



Esteban Bustamante

View solution in original post

8 Replies

Avatar

Community Advisor

Hi @jainrupal2408 

 

You can look for the below working links to know more integrating AEM with Google Analytics.

 

To provide a quick approach 

1) Setup the GTM dashboard.

2)Setup the events fields and values, file types that are needed for tracking

3)Once configuration is completed get the scripts .

4) Add the scripts at the template level , head.html if you are looking for page tracking if on component basis add the snippet based on conditions. 

5) Use chrome extensions like Tag Manager Assistant to verify the events are captured.

 

https://medium.com/@anshulag_/custom-rating-component-in-aem-bcdfd2b0e3b9

 

https://aemsimplifiedbynikhil.wordpress.com/2021/04/09/track-documents-download-in-your-web-applicat...

 

 

Avatar

Community Advisor

Hi @jainrupal2408 Google analytics integration is just simply including the GTM script in the head.html for the template.

 

You even need to connect with the Google Analytics team, as that team is responsible for creating the funnel tracking and other activities.

As per the business get all the requirement, which click event or the scroll event or any other event data needs to be captured and the what json structure is required by the GA team (as exit url, redirect url, etc are captured differently by the Google Analytics) for further processing.

 

You can use various tools e.g. Datalayer Checker (https://chrome.google.com/webstore/detail/datalayer-checker/ffljdddodmkedhkcjhpmdajhjdbkogketo check what is the data that is sent to the Google Analytics.

 

Hope this helps!

Thanks 

Avatar

Correct answer by
Community Advisor

There are no one-size-fits-all best practices because everything is scenario-based; there is no universal rule. It depends on several factors, such as the version of AEM, available products, and how the code is structured.

My personal preference, if available, is to integrate Google Analytics through Adobe Launch, which is a straightforward and seamless process. You can find a helpful document explaining how to do this here: https://www.bounteous.com/insights/2019/10/03/implementing-google-analytics-adobe-launch. If you don't have Adobe Launch available, you can simply add the "script" tag from Google Analytics to your head tag (template).

I hope this helps!



Esteban Bustamante

Avatar

Level 1

Thank you for all of your prompt responses. To find out which approach works better, I'll research both utilizing Adobe Launch and template level adjustments.

Avatar

Level 3

Thank you all for quick response. I will check out both methods with template level and Adobe Launch. 

 

Regards,

Rupal

Avatar

Level 1

I appreciate all of your quick answers. I'll investigate both strategies using Adobe Launch and template level modifications to see which works best. Lansum Elena