In this article:
- Introduction
∘ Enhanced Event Measurement and custom events - Step 1: Preparations
∘ Connecting Google Tag Manager to Publitas
∘ Tracking embedded publications
∘ Cross Domain Tracking
∘ Creating a dedicated property for publications - Step 2: Install the preset container settings in Google Tag Manager
∘ Importing the preset
∘ Connecting new tags to the GA4 configuration - Step 3: Add custom dimensions to Google Analytics
- Step 4: Test the connection
- Downloads
Introduction
This article describes how to use Google Tag Manager to connect Google Analytics 4 (GA4) to your online publications. But first, there are a few important things to know about making the connection as effective as possible.
Enhanced Event Measurement and custom events
Publitas leverages Enhanced Event Measurement to track pageviews and user flow. 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.
Check out GA4 events recorded for online publications
GA4 Data Stream with Enhanced measurement enabled:
Step 1: Preparations
Connecting 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.
Click here for more information.
Connect a custom domain to your publications (recommended)
As of this moment, GA4 still relies on cookies to track data. For embedded publications to be able to set and update cookies, the embedded domain needs to be the same as the domain of the website embedding it. Make sure to connect a custom domain to your publications that matches your website's domain.
For example, connect catalog.mydomain.com to the publications if your website is www.mydomain.com.
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.
Click here to learn more about connecting a custom domain to your publications.
Cross Domain Tracking (recommended)
Do you wish to learn more about how publications influence shopping behavior and do you want to allocate sales to the original source of traffic? Then go for tracking your website and online publications in a cross domain tracking setup. Combining publication and website data allows you to build catalog-specific audiences and leverage GA4's predictive insights to learn more about catalog readers' shopping behavior.
Consider the following preparations:
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, found at the bottom
- Select Configure your domains and add a condition where the domain exactly matches view.publitas.com or your custom publication domain
In Google Tag Manager
- Create a new trigger, selecting Page View as the trigger type
- Make sure the trigger fires on Some Page Views and apply the condition Page Hostname - equals - view.publitas.com (or 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
Creating a dedicated property for publications
If you don't want to combine website and publication data in the same property through cross domain tracking, start off by creating a dedicated property following these steps.
(If did choose cross domain tracking, go directly to Install the preset container settings in Google Tag Manager)
In Google Analytics
- Go to the Admin section, found in the bottom left corner
- Select the correct account in the first column (if applicable), then select Create property at the top of the second column
- Enter a name for the new property, then select the applicable time zone and currency
- Click on Next and on Create (entering the details of your business is optional)
- Select Web and enter view.publitas.com or your custom domain as the Website URL
- Enter a Stream name (e.g. use the publication domain)
- Make sure the Enhanced Measurement is enabled, then copy the Measurement ID
- Go to Data Settings in the admin section, and change Data Retention to 14 months
In Google Tag Manager
- Add a new "Google Analytics: GA4 Configuration" tag
- Paste the Measurement ID and keep the default settings
- Select "All Pages" for the tag's trigger
- Give the new tag a name (e.g. "GA4 - Publitas Configuration") before saving the changes
GA4 Configuration tag:
Step 2: Install the preset container settings in Google Tag Manager
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
Step 3: Add custom dimensions to Google Analytics
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 store these event parameters in Google Analytics as well, custom dimensions need to be created for each of them.
Click here to find all events and parameters recorded for online publications
In Google Analytics, go to Admin > Custom Definitions to create the following set of custom dimensions:
Dimension name |
Event parameter |
Scope |
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 4: 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
- 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: