Jahia Google Analytics

November 14, 2023

There are two modules available on the Jahia store that you can use to add Google Analytics functionality for your sites.

  • Jahia Google Analytics
    Adds the Google Analytics tag to your Jahia website and enables you to view tracking metrics in Google Analytics
  • Google Analytics for jExperience
    Enables you to view events in Google Analytics that occur when a personalization or an AB test variant displays on your site

Enabling and using Jahia Google Analytics

The Jahia Google Analytics module enables you to add the Google Analytics tag to your Jahia website. The Google Analytics tag is JavaScript code that performs tracking on your website so that you can capture your metrics in Google Analytics.

Note: You do not require this module if you have added the Google Analytics tag through the Google Tag Manager or from your own module, for example, if your developers coded a custom filter.

Installing and deploying Jahia Google Analytics

Install the Jahia Google Analytics module as any other Jahia module and ensure that it is activated on your website. For more information on installing modules, see Installing a module tutorial.

Configuring Jahia Google Analytics

You first require your Google Analytics Tracking ID to configure the module. Then you add the Tracking ID information to your site in Jahia.

To configure Jahia Google Analytics:

  1. First, get your Tracking ID:
    1. Login to Google Analytics at analytics.google.com.
    2. In the Admin section, select an account and a property.
    3. Under Property, select Tracking Info>Tracking Code.
      image01.png
    4. In Jahia, open Page Composer, right-click on your site name and click Edit.
      image02.png
  2. In Google Analytics Site Settings>Google Analytics Site ID, enter your Tracking ID. You do not need to change the value in the Google Analytics cookie live time before expiration (seconds) field as the default value is set to 1 year (31536000 seconds).
    image03.png
  3. Save and publish the site.

Google begins to track and report on your web traffic. You can login to Google Analytics to verify that tracking is occurring.


Using Google Analytics for jExperience

The Google Analytics for jExperience module sends events to Google Analytics each time a personalization or an AB test variant displays on your site. This is helpful for digital marketers who want to see how many times each jExperience variant has displayed in Google Analytics.

If you have configured the first module, then this module doesn’t need any configuration. You just need to deploy it on your platform and activate it on your site.

To see events sent to Google Analytics:

  1. In Google Analytics, go to Real-time>Events. If there is live traffic on your website, you’ll see events display in the table under Events.
    image04.png
  2. You can view event category, action, and label information in the table for events sent from jExperience.
    image05.png
    • Event Category contains one of the following values: 
      • Personalization
        Indicates a content-level personalization
      • Optimization
        Indicates a content-level AB test
      • Page_personalization
        Indicates a page-level personalization
      • Page_optimization
        Indicates a page-level AB test
      • Event Action
        The field is automatically set to Display.
      • Event Label
        The field uses the following syntax:
        <title of the personalization or AB Test> - <title of variant>
      • Active Users
  3. To see the events labels, you need to filter on an event category:
    image06.png
  4. This example shows filtering with an AB Test:
    image07.png

    Which shows
    image08.png
  5. Here is an example of the HTTP call that is sent to the Google Analytics event API: 

https://www.google-analytics.com/collect?v=1&_v=j83&a=1716839054&t=event&_s=2&dl=https%3A%2F%2Fproduct-internal-rgauthier.aws-eu-west-1.j.jahia.com%2Fsites%2Fdigitall%2Fhome%2Fpage.html&ul=en-us&de=UTF-8&dt=arandompage&sd=24-bit&sr=1680x1050&vp=1486x275&je=0&ec=optimization&ea=Display&el=AB%20Test-variant%20B&ev=5&_u=CAEAAAAB~&jid=&gjid=&cid=1640370338.1575556285&tid=UA-170496527-1&_gid=1556837767.1592829366&z=1746533052