Integrate Google Analytics in AEM website | Community
Skip to main content
September 5, 2023
Solved

Integrate Google Analytics in AEM website

  • September 5, 2023
  • 7 replies
  • 5047 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by EstebanBustamante

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!

7 replies

sherinregi-1
Community Advisor
Community Advisor
September 5, 2023

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-applications-google-tag-manager-integration-with-aem-6-5-5-spa/

 

 

ShaileshBassi
Community Advisor
Community Advisor
September 5, 2023

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 

EstebanBustamante
Community Advisor and Adobe Champion
EstebanBustamanteCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
September 5, 2023

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
February 26, 2024

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.

Harwinder-singh
Community Advisor
Community Advisor
September 5, 2023
September 6, 2023

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

 

Regards,

Rupal

January 3, 2024
February 14, 2024

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