Wednesday 12 November 2014

AEM integration with Google Analytics and Google Tag Manager




Google Analytics and Google Tag Manager are analytical tools that help to analyze the statistics of web site which is helpful as per the business prospective. Organization can monitor which are widely used web pages and which are least use by the visitor. Here I am going to demonstrate how you can integrate AEM with Google Analytics and also will use the GTM tags to use in AEM.


1)      Organization must have the google analytics account, If one already have then we can get the tracking code by navigate to the admin tab then click on the tracking info section and copy your tracking id and tracking code on some txt file as these two properties initially we need.
2)      Go to tools section of AEM. Navigate to the Generic Analytics Snippet and create the new configuration. Inside Snippet JavaScript Code just paste your tracking code & ok.
 
1)      We need to add this cloudservice onto the page that we want that we want to analyze.  If we want to analyze the whole site then just add that cloud service onto the topmost page of hierarchy like en-US.
2)      Now login to the Google Tag Manager. Follow the link to create a tag that will track outbound link. Below is the snapshot of rule that I applied. Also make sure you will have the js code that you get from GTM  inside body.jsp or what they mentioned in blog.




1)      For testing you can also debug your tag via overview then upon clicking preview button.
2)      Open you site hosted on 127.0.0.1:8502 then open some page and click on any external link.  Now any click event that redirect you out of the site will get track.
3)      We can check the analytics. Go to the reporting tab and in search look for the event you will find Behavior >Event >Page the you will be able to see events. Click on the page on which event fired.
 

1 comment:

  1. This comment has been removed by the author.

    ReplyDelete