This article describes how to activate the Google Analytics 4 integration to start tracking your online publications. The main focus of the article is to track the online publications in the same GA4 property that is tracking your website (cross domain tracking). Doing so will preserve Google's capabilities to allocate sales to the original source of traffic. It also supports building catalog-specific audiences and leverage GA4's predictive insights to learn more about catalog readers' shopping behavior.
Step 1: Enable Enhanced Event Measurement
Publitas leverages Enhanced Event Measurement to track pageviews and user flow. Most properties have this enabled by default.
Custom pageview events are also recorded, which contain publication-specific details that can be used for advanced reporting. Other custom events are recorded to help track the performance of your online publications and build richer audiences.
GA4 Data Stream with Enhanced measurement enabled:
Step 2: Connect a custom domain to your publications
For Google Analytics to track online publications, embedded on your site, it needs the domain of both the website and publication to match.
When a publication, hosted on view.publitas.com, is embedded on a website hosted www.mydomain.com, Google Analytics will not record any data. If the embedded publication uses catalog.mydomain.com in its URL, Google Analytics will be able to track the publication.
This is why it is important to make sure that your online publications are published using a subdomain of your site's domain. Once a custom domain is connected to your publication, the embed code is also updated to use the new domain. Make sure to replace any previous embed codes with the new ones.
Step 3: Configure the publication domain in the Data Stream
- In Google Analytics, locate the website's property in the Admin section and select Data streams
- Click on the data stream for web and first copy the Measurement ID
- Then, go to Configure tag settings near the bottom
- Select Configure your domains and add a condition where the domain exactly matches your custom publication domain
Step 4: Connect the Measurement ID to Publitas
To connect the Publitas to Google Analytics, open the Group Settings menu in Publitas and add the Measurement ID that was copied in the previous step. Make sure to store the changes by clicking on "Save Settings".
Adding a Measurement ID to connect Google Analytics:
Step 5: Add custom dimensions to Google Analytics
IMPORTANT: Make sure to disable automatic translation of this page
before completing this step.
Out of the box, all custom events are recorded by Google Analytics. Each event contains a set of event parameters to support advanced filtering of data in reports and dashboards. To record the event parameters as well, you'll need to add them as custom dimensions in Google Analytics.
In Google Analytics, go to Admin > Custom Definitions to create the following set of custom dimensions:
|Publitas Collection Name||pbl_collection||Event|
|Publitas Event Action||pbl_action||Event|
|Publitas Event Value||pbl_value||Event|
|Publitas Group Name||pbl_group||Event|
|Publitas Page Number||pbl_page||Event|
|Publitas Product ID||pbl_product_id||Event|
|Publitas Product Title||pbl_product_title||Event|
|Publitas Publication Name||pbl_publication||Event|
Step 6: Test the connection
Once the setup is completed your publications will be tracked by Google Analytics.
To verify the connection, select the connected property in Google Analytics. The home page will appear which also shows you the users that were active in the last 30 minutes. The connection with Google Analytics is successful if this widget shows at least one active user within a minute after you open one of the publications in your browser.
Make sure to have a publication open somewhere while looking for active users:
Step 7: Ask users for consent (optional)
When asking users to consent to being tracked, Google Analytics will only start tracking once consent has been given. If no consent is provided, no data will be stored.
To optimize the consent request you can change the banner text, displayed when a publication is opened.
Enabling the option to ask for consent first:
Preview of the consent banner: