In this article:
- Step 1: Connect Google Tag Manager to Publitas
- Step 2: Enable Enhanced Event Measurement
- Step 3: Connect a custom domain to your publications
- Step 4: Configure the publication domain in the Data Stream
- Step 5: Import and configure the Google Tag Manager container settings
∘ Importing the preset
∘ Connecting new tags to the GA4 configuration
∘ Exclude existing tags from firing in publications
∘ Make publication tracking conditional on user consent
- Step 6: Add custom dimensions to Google Analytics
- Step 7: Test the connection
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: Connect Google Tag Manager to Publitas
To enable installing tags onto your publications, first connect Google Tag Manager to Publitas.
If you aim to track the publication in a dedicated property, it is recommended to create a dedicated container in Google Tag Manager. This way you don't have to worry about any existing tags firing on the publications as well.
Step 2: 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 3: 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 4: Configure the publication domain in the Data Stream
- In Google Analytics, locate the property in the Admin section and select Data streams
- Click on the data stream for web and go to Configure tag settings near the bottom
- Select Configure your domains and add a condition where the domain exactly matches view.publitas.com or your custom publication domain
Step 5: Import and configure the Google Tag Manager container settings
Recording custom events requires custom data. Publitas uses the data layer to feed Google Tag Manager the necessary data. Below are the steps to import the variables, triggers and tags required to install Publitas' preset tracking configuration.
Importing the preset
- Download the container file attached to this article
- After selecting the container in Google Tag Manager, go to the Admin section
- Select Import Container and choose the downloaded file from your computer
- Click on Existing workspace and select the desired workspace
- Merge the selected workspace with content of imported container, select Rename conflicting tags, triggers, and variables and click Confirm
Connecting new tags to the GA4 configuration
- Go to the Tags section and connect GA4 - Publitas Virtual Pageview tracking and GA4 - Publitas Event tracking to the GA4 configuration tag you prepared earlier
- Complete the setup by deleting the PLACEHOLDER GA4 CONFIG TAG
Exclude existing tags from firing in publications
- Create a new trigger, selecting Page View as the trigger type (or use the copy in the downloadable preset)
- Make sure the trigger fires on Some Page Views and apply the condition Page Hostname - equals - [your custom publication domain]
- Apply the new trigger as an exception to all existing tags that (will) fire on the publications as well, now that the container is also active there
TIP: Look for tags with the All Pages trigger
Make publication tracking conditional on user consent
If you're using Google Tag Manager to make your tracking solutions conditional on user consent, you might be able to apply the same solution to the new tags for tracking your online publications, since the publications are managed within the same container and hosted on the same domain as the website is.
Step 6: 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 7: Test the connection
Once the setup is completed your publications will be tracked by Google Analytics. To verify that data is coming in correctly:
- In Google Tag Manager, load any publication that should be tracked by Google Analytics in preview mode (for embedded publications this does not work if the changes aren't live)
- In Google Analytics, go to Admin > DebugView and look for the events coming in when you browse through and interact with the publication
DebugView in Google Analytics: