How to Redact Email Addresses and Query Parameters in Google Analytics 4

No comments yet

Today, we’re diving into a nifty GA4 feature that helps you redact sensitive data like email addresses and query parameters.

Why Redact Data?

Redacting data is crucial for privacy and compliance reasons. You don’t want to accidentally collect sensitive user info.

Step-by-Step Guide

Head to Admin Area

  1. Go to Admin: Open your GA4 property and head to the Admin area.
  2. Data Streams: Click on ‘Data Streams’ and select your web data stream.

Redact Email Addresses

  1. Redact Data: Scroll down to find the ‘Redact Data’ option.
  2. Enable Radio Button: Simply enable the radio button next to ‘Email Addresses’.

Redact Query Parameters

  1. Check Your Data: Before redacting query parameters, check which ones are actually in your data. Neil recommends creating a free-form report in GA4.
  2. Add Query Parameters: In the ‘Redact Data’ section, you can add up to 30 query parameters. Separate them with commas.

For example:

  • gtm_debug,
  • fbclid
  1. Save: Don’t forget to hit save!

Verify

After a day or two, revisit your free-form reports to make sure the redacted data is no longer appearing.

Popular Query Parameters to Consider

Check out our list of popular query parameters like gtm_debug and fbclid.

Final Thoughts

That’s it! A simple yet effective way to keep your GA4 data clean and compliant. Check back in a day or two to make sure it’s all working as it should.

You can also check out more of our blogs here.

How to Set Up a GA4 Roll-Up Property

No comments yet

Introduction

Tracking user behaviour across multiple websites is crucial for businesses, Google Analytics 4 (GA4) offers a solution through its roll-up property feature. This blog post aims to guide you through the process of setting up a roll-up property in GA4 using Google Tag Manager (GTM). You can either watch the video tutorial below or continue reading for a step-by-step guide.

Creating a GA4 Roll-Up Property

  1. Navigate to GA4: Open your GA4 account and create a new property. This will be your roll-up property.
  2. Name the Property: Give it a descriptive name, such as Roll-up Property, so that users can easily identify it.
  3. Copy Measurement ID: Once the property is set up, go to ‘Data Streams’ and copy the ‘Measurement ID’.

Creating a Duplicate Google Tag in GTM

  1. Open GTM: Go to your Google Tag Manager account and create a new workspace.
  2. Duplicate the Tag: Click the three dots next to the Google Tag and select ‘Duplicate’.
  3. Rename the Tag: Give the duplicated tag a new name to indicate it’s for the roll-up property.
  4. Update Measurement ID: Change the ‘Measurement ID’ in the duplicated tag to the one you copied from your GA4 roll-up property by creating a new variable. If the site only has one environment, you can create a Constant variable and past the Measurement ID into the variable.

Setting Up Cookies

  1. Add Cookie Prefix: In the duplicated tag, add a new parameter called ‘cookie_prefix’.
  2. Set Prefix Value: Assign the value ‘roll-up’ to the ‘cookie_prefix’. This ensures that the cookies for the roll-up property are distinct from your main property.

Duplicating Event Tags in GTM

  1. Find Event Tag: In the same GTM workspace, locate the event tag you want to duplicate.
  2. Duplicate the Tag: Click the three dots next to the event tag and select ‘Duplicate’.
  3. Rename the Tag: Give the event tag a new name to indicate it’s for the roll-up property.
  4. Update Measurement ID: Change the ‘Measurement ID’ to the one you copied from your GA4 roll-up property.

Configuring Cross-Domain Tracking

  1. Go to GA4 Roll-Up Property: Navigate back to your GA4 roll-up property.
  2. Configure Domains: Go to ‘Data Streams’ and click on ‘Configure Domains’. Add all the domains you want to track.

Testing Your Setup: A Deep Dive

GTM Preview Mode

  1. Activate Preview Mode: In GTM, activate the preview mode to test your setup before publishing.
  2. Check Events: Make sure that both the normal and roll-up page view events are firing. You should see these events in the GTM preview pane at the bottom of your website.
GA4 Roll-Up property

Chrome Developer Tools for Cookie Inspection

  1. Open Developer Tools: Right-click anywhere on your website and select ‘Inspect’ to open Chrome Developer Tools.
  2. Navigate to Application Tab: In the Developer Tools, go to the ‘Application’ tab.
  3. Check Cookies: Here, you’ll see a list of cookies. Look for cookies with the ‘roll-up’ prefix to ensure that your cookie prefix setup is working.

Chrome Developer Tools for Event Inspection

  1. Go to Network Tab: Still in Chrome Developer Tools, switch to the ‘Network’ tab.
  2. Refresh the Page: Refresh your website page to trigger the events.
  3. Check Measurement IDs: In the ‘Network’ tab, you should see network requests with different measurement IDs. These IDs should match the ones you’ve set up for your main and roll-up properties.
  4. Inspect Payloads: Click on these network requests to inspect their payloads. You should see ‘page view’ events for both measurement IDs, confirming that events are being sent to both properties.

By following these steps, you’ll ensure that your roll-up property is not just set up correctly but is also capturing data. This comprehensive testing using GTM Preview Mode and Chrome Developer Tools is crucial for confirming that your setup is flawless.

And there you have it! A comprehensive guide to setting up a roll-up property in GA4 using GTM. This allows you to aggregate data from multiple sites into one property, making it easier to analyse user behaviour across platforms.

You can read more of our blogs here.

How to Track Events in Google Analytics 4 with Google Tag Manager

No comments yet

Tracking events in Google Analytics 4 lies at the heart of Google’s new AI powered web analytics platform. Unlike Universal Analytics, Google Analytics 4 uses an event driven model to identify new insights about web or app users. GA4 automatically measure some types of events, such as clicks on external links, but it many other respects it relies on the user to create and configure events in Google Analytics 4.

GA4 doesn’t have the rigid event structure of Category, Action, Label and value which we associate with Universal Analytics. Instead, events in Google Analytics 4 use parameters so that users can create their own naming conventions. However, this flexibility means the user needs to take greater care with planning and implementing events to ensure consistency and logic with the event structure.

How To Upgrade To Google Analytics 4

Please see my separate blog post if you are considering creating a GA4 property. In the post I explain the differences between GA4 and Universal Analytics and why you should consider upgrading and retaining your Universal Analytics property.

1. Planning Event Creation:

Nothing should change regarding your event planning with tracking events in Google Analytics 4. Event tracking should be driven by your measurement plan which in turn should have been informed by your ecommerce performance framework. It’s important to begin with the customer’s objectives and identify the relevant leading indicators so that you focus on the relevant areas to optimise on your website or app.

Ecommerce Performance Framework for determining custom metrics needed
Source: Jonny Longden

In this post we will concentrate on website events and how to implement them via Google Tag Manager. However, many of the principles remain the same for app tracking and website analytics.

2. Structure of Events in Google Analytics 4:

In GA4, all events have a parameter called Event Name and the following parameters are captured by default, including for custom events.

  • language
  • page_location
  • page_referrer
  • page_title
  • screen_resolution

Other than the above parameters, the event parameters used are determined by what you plan and implement. For example, for my website’s contact form we could send the following event name and parameters to GA4:

  • Event Name: contact_us
  • Optimisation_area: web_analytics
  • digital_platform: website
  • industry_sector: financial_services

3. Types of Events:

Events in Google Analytics 4 have four types of events:

  • Automatically measured events
  • Enhanced Measurement events
  • Recommended events
  • Custom events

Before creating any custom event it’s recommended that you first check all the events in the other categories. Only if you can’t find your event in one of the first three types of events should you think of creating a custom event. Let’s look at each of the event types.

4. Automatically collected events in Google Analytics 4:

You can view a comprehensive list of events that GA4 automatically collects here. Most events relate to apps, because GA4 has Firebase as a backend. A number of events are collected once you enable enhanced measurement, but I will cover those in the next section. Events that are automatically collected are:

  • First_visit. The first time a user visits a website (or launches an Android instant app).
  • Session_start. When a user engages an app or website.
  • User_engagement. This has a single parameter (engagement_time_msec) to periodically track engagement time.

5. Enhanced measurement events:

When you first create your GA4 property and configure a web data stream you will be presented with the opportunity to use Enhanced Measurement. This allows you to track additional automatic events once you have added the GA4 configuration tag to the page. To understand how to add the configuration tag go to my blog how to upgrade to Google Analytics 4 with Google Tag Manager.

Enhanced Measurement is enabled by default, but to view it you just need to go to Admin in your GA4 property. Next, select Data Streams < your Web data stream and this will open the window below. I’ve selected ‘+3 more’ to show all the events Enhanced Measurement tracks.

1 Enhanced Measurement events in GA4
  • Page_view – Parameters are page_location (page URL), and page_referrer.
  • Scroll – The first time a user reaches the bottom of each page (90% of vertical depth).
  • Click – outbound clicks
  • View_search_results – Site search. Parameters include search_term.
  • Video_start – When video starts to play. Parameters include video_current_time, video_duration, video_percent and video_url.
  • File_download – For when users click a link leading to a common file extension. Parameters include file_extension, file_name link_classes and link_url.

As enhanced measurement events are tracked automatically, you can’t remove or edit the parameters that come with each event. You can include other parameters to these events by adding them to the configuration tag. Not everyone wants to enable enhanced measurement events, partly because they include the scroll event and I for one like to control when this type of event fires. Click on the data stream setting (2 above) if you need to disable these events.

6. Recommended events:

These are events that Google suggests you consider as standard to set up and configure for your GA4 property. You can access the full list from this Google menu on GA4 events. It begins with generic events for all sectors and then outlines events for individual sectors.

We can expect this list of sectors to grow over time and so keep a look-out for additions in the coming months and years.

Before you create any new Google Analytics 4 events it’s best to check all these lists to see if Google has a recommended event that covers what you want to measure. That’s because Google recommends you implement these events when appropriate. This makes it easier for Google Analytics’ reports to process your data and to identify insights using GA4’s machine learning capabilities.

Google recommends certain parameters for use with these events. For example, for sign up they suggest using a ‘method’ parameter to indicate how users register for your website (e.g. email, sms, Facebook etc).

2 GA4 Recommended events - All sectors

Example of Recommended Event: Sign-up:

If we continue with this example of a recommended event, we would ask a developer to activate a data.layer push script when a user completes registration. This would normally be placed above the GTM script on the sign-up confirmation page. The value of the signupMethod must be replaced dynamically by the function written by the developer so that it reflects the choice selected by the user.

<script>

window.dataLayer = window.dataLayer | | [ ];

window.dataLayer.push ({

‘event’ : ‘sign_up’,

‘signupMethod’ : ‘sms’ // this should be replaced with chosen sign up method

}) ;

</script>

Data Layer Variable:

Once the script has been placed on the confirmation page or it is activated on successful form submission, use GTM Preview mode to test and debug it. You should be able to see the Data Layer event in GTM, but this won’t fire a tag to any Google Analytics property.

To trigger a tag to send data to GA4 we first need to create a Data Layer Variable. Go to your GTM container and select Variables > User defined variable > New

  • Name: DLV – signupMethod
  • Variable Type: Data Layer Variable
  • Data Layer Variable Name: Use the exact same parameter name as you used in the data layer push script (e.g. signupMethod).
3 DLV - signupMethod

Now, let’s go to Trigger > New. We will create a custom event trigger and so configure it as follows:

  • Name: Custom – signup
  • Trigger Type: Custom Event
  • Event name: sign_up (use the recommended event name)
4 Custom Trigger - sign_up

You can now save your trigger so that it is available for your tag.

Before we create a tag for the event, it’s worth checking that you have a GA4 Configuration Tag set up in GTM. This contains your GA4 Measurement ID and may have other configurations you want to use across all your GA4 Tags. This is similar to the GA Settings Variable for Universal Analytics.

Now go to Tags > New and configure it as follows:

  • Name: GA4 Event – Signup
  • Tag Configuration: Google Analytics: GA4 Event
5 GA4 Event Tag - Select GA4 Event
  • Configuration Tag: Select your GA4 Configuration Tag
  • Event Name: sign_up (use the exact same name in the data layer push script)
  • Event Parameters
  • Parameter Name: method (use the name shown in the list of recommended events).
  • Value: {{DLV – signupMethod}} (by searching for the variable you have just created).
6 GA4 Event Tag for sign_up

Now add the new trigger you created for the sign_up event.

You may also want to add custom parameters to your tag. You can include custom parameters in the same tag provided you have included the values of your custom parameters in your data layer push. We will cover custom parameters shortly.

Now save the tag and enable the Preview mode in GTM to test your tag implementation. You can then sign up to your website or newsletter to check the tag is working correctly.

7. Custom Events:

If you have exhausted the list of GA4 events documented by Google, you have the opportunity to create custom events. The process for creating custom events is the same as for other types of events, except you will need to decide upon the event names and parameters.

There is a limit of 500 unique event names for each GA4 property and so you should only create events which are in your measurement plan. Be careful as you can’t delete unused events and Google says it will block any events over this threshold. Although you can collect more than 25 parameters in each tag, GA4 will only allow 25 to be sent to reporting.

Example of Custom Event:

On the homepage of Conversion Uplift there are a number of different call-to-action buttons that I want to measure interactions with. As the homepage is an important landing page it’s appropriate to track clicks on the CTAs and understand the relative value of the different CTAs.

However, before we create any tags it’s necessary to check you have all click variables enabled in GTM. Go to GTM > Varibles > Built-in Variables > Configure and ensure all click variables are checked as shown below.

7 Enable built in variables in GTM

Now we can open GTM Preview mode to interact with the homepage CTAs that we want to track. By clicking on the first CTA we can then select the ‘Link Click’ in GTM to view the data in the ‘Variables’ tab. This allows us to identify the Click Classes and other information captured by GTM which we can use to isolate the clicks we wish to measure.

8 GTM Preview Mode - Variables

In this instance we can see that the ‘Click Classes’ clearly identifies that a button was interacted with. The ‘elementor-button-link’ is the same for all button CTAs on the homepage and we know the click text is different on each button. This means we can use this fragment from the Click Classes to identify the buttons on the homepage.

9 Click classes

Creating A Trigger:

Let’s use this information to create a new trigger in GTM for our homepage CTAs. As it’s a button we want to set up a Link Click trigger and so we can use ‘Just Links’ as the trigger type and ‘Some Link Clicks’. We can use the Click Classes contains ‘elementor-button-link’ to identify a button and Page Path equals ‘/’ because the CTAs are on the homepage.

This ensures the tag will only fire when these conditions are met. If you are looking for a tag to fire on all buttons site wide which contain the same ‘Click Classes’ variable text you don’t need a Page Path rule.

10 CTA Click Trigger

Now go to Tags > New and give your tag a name with the prefix ‘GA4’ so that it is easily distinguishable from your Universal Analytics tags. I would also create an appropriate folder for your GA4 tags.

Now Configure It As follows:

  • Tag Type: Google Analytics: GA4 Event
  • Configuration Tag: Select your GA4 Config Tag
  • Event Name: HP_CTA_Click – use a descriptive name
  • Event Parameters:
  • Parameter Name: hp_cta_link_url
  • Parameter Value: click on the Insert Variable button and select {{Click URL}}
  • Second Parameter Name: hp_cta_name
  • Second Parameter Value: click on the insert variable button and select {{Click Text}}

You can send up to 25 custom parameters for each event. Make sure the names are descriptive as you don’t want any confusion about what they are measuring. You can now add the new just links trigger to the tag and save it. You can’t use the prefix google_,ga_ or firebase_ when you name your parameters as these would obviously conflict with existing GA4 parameters.

11 GA4 Tag for Custom Event

Before you publish the changes make sure you test that the tag is firing correctly. Enable your GTM Preview mode and click on each CTA to check it fires the new tag. We can see below that a Link Click fires the GA4 – Event – HP CTAs tag as expected.

12 GTM Preview Mode GA4 Custom Event Tag

Register Custom Definitions:

To use any event parameter in standard reports, Funnel reports, Exploration etc you must first register these in the GA4 user interface. Go to your GA4 property and ‘Events’ and select the ‘Manage Custom Definitions’ CTA.

13 GA4 Manage Custom Definitions

You should then click ‘Create Custom Dimensions’ and this will open the ‘Custom Definitions > Dimensions’ screen. Enter your event parameter name as defined in your tag and save it. This will ensure your custom parameter is available in your GA4 reports. The name in reports is shown below the input box under “Custom dimension name”.

14 GA4 Custom Definitions Dimensions

8. Create Events in the GA4 Console:

Goals are conversions in GA4, and these include pageviews. However, all pageviews are lumped together as a single category of event in GA4. This is not much use if you want to set an individual pageview as a conversion. For this reason, GA4 allows you to create events for individual pages in the interface. Go to my blog post on how to create events in the Google Analytics 4 interface for more details.

Summary of GA4 Events:

Google Analytics 4 is all about events because it doesn’t measure anything else. However, it’s not a finished product and so it will continue to evolve over time. This means it’s a great time to begin learning about GA4 and how to create events because it is the future for Google’s web analytics.

Remember to use your measurement plan to drive event creation in GA4 as you should have a clear strategy to improve insights from your web analytics. You should first check the events in each of these categories before considering creating a custom event.

  • Automatic events
  • Enhanced events
  • Recommended events

Only once you have exhausted the events covered by these categories of events should you create your custom events. This is to ensure you utilise the benefits of setting up events that GA4 is already configured to understand. You should also use the GA4 interface to create events for individual pages on your site so that you can create funnels and conduct other analysis which is related to site navigation.

However, I would only create those recommended events that are consistent with your measurement plan and are relevant to your business model. Custom events allow you to tailor event tracking to your business and so I would concentrate on using them to improve insights rather than setting up unnecessary recommended events.