Displaying items by tag: ga4

Sunday, 21 January 2024 19:57

How to track HubSpot Forms in GTM? Supercharged!

HubSpot stands out as a powerful CRM widely embraced in the marketing sphere. One common query that surfaces is how to effectively track HubSpot Forms using Google Tag Manager (GTM). The process is straightforward and adds a valuable tool to your GTM toolkit. We've drawn insights from Clarity Global (formerly 3WhiteHats) and Analytics Mania's Julius Fedorovicius for this technique, ensuring a robust foundation.

In our example, we go beyond the basics by extending the code to access form data, providing richer information for our marketing tags. While we specifically use GA4 Event tags in our illustration, this approach can be extended to various marketing tags like Facebook, TikTok, LinkedIn, and more. However, it's crucial to ensure compliance with organizational privacy policies and legal regulations such as GDPR or CCPA.

Implementation Steps

Step 1: Create and HTML Tag in GTM

Begin by creating an HTML tag in GTM that listens for the HubSpot FormSubmitted Event. Detailed information can be found here. The raw code below should be copied and pasted into GTM.

  window.addEventListener("message", function(event) {
    if (event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmitted') {
        'event': 'hubspot-form-success',
        'hs-form-guid': event.data.id,
        'data': event.data,
    } else if (event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady') {
      window.dataLayer.push({ 'event': 'hubspot-form-ready', 'hs-form-guid': event.data.id });

This code has been extended to include the submitted form data in the dataLayer, that is done by this line:

'data' : event.data

What this line does put the form data in the dataLayer.  What you will see in the dataLayer will depend on how your form has been created, in the video we will show how to review the dataLayer so that you can create your own customized Data Layer type variables.

HubSpot Form Tracking GTM Form Listener

Employ a DOM Ready Pageview trigger for the tag to ensure the complete rendering of the HubSpot form. (For extra credit you could detect a HubSpot form and only fire when one is present, but for now we will use all pages.)

Step 2: Create a Variable for the Form Data

Generate variables for the form data; for instance, 'company' in our example. The full variable name in the dataLayer is:


Adjust the final part based on your HubSpot form's variable names.  You can find them in the dataLayer formSubmission object.

HubSpot Form Tracking GTM Form Variable

Step 3: Set up a Trigger

Create a trigger to detect the 'hubspot-form-success' event defined in the listener.

HubSpotFormTrackingGTM Trigger

Step 4: Create a GA4 Event Tag

Finally, craft a GA4 Event tag using the HubSpot Form Submit trigger to send back the form variable.

HubSpotFormTrackingGTM GA4Event

With these steps, you now have a fully operational HubSpot Form tracker in GTM. Feel free to include additional form variables and channel this data to other tags. Embrace the advantages of a consistent Form Submit trigger for more accurate conversion tracking compared to traditional "thank-you" pages.

Happy Tracking! If you have any questions, whether about this or other GA4/GTM topics, let us know — we're here to help.




Published in Blog
Sunday, 31 December 2023 22:18

How to Filter by IP Address in GA4?


Filtering out internal traffic from your GA4 data will insure accuracy in your reporting and analysis.  This guide walks through how to define internal traffic with IP Addresses and then apply this definition to a GA4 Filter.  GA4 is not as easy as the way Univeral Analytics worked (like most GA4 processes).  This article, along with the associated video, will step through this process completely.  If you have any additional questions or comments feel free to asking in the comments below.  New topic questions are always welcome!  When you have setup your IP filters you can be assured of more accurate data without internal traffic from marketers, developers and other internal traffic throwing your analysis off.

How to Define Internal Traffic using an IP Address?

The first step of this process is defining internal traffic using an IP Address.  We will use an example IP Address of 123.456.78.9 - you can find the right IP Address by typing in "What is my IP?" in Google search or check with your network team to find a range of IP Addresses. 
Now navigate to the "Define internal traffic" page.  ( Admin -> Data streams -> click on Data Stream -> Configure tag settings -> click "Show more" -> Define internal traffic ) and you will see this screen:
 ga4 ip filtering define internal traffic
After clicking on the creat button you will see this screen:
ga4 ip filtering defininf internal traffic with an ip address 
Defining Internal Traffic by an IP Address 
Enter in a unqiue name for your "Rule name".  Notice that "traffic_type" value is defined as "internal", this is what will be used in the filter step to filter out this traffic.  You can create new "traffic_type"s at this point as well if you would like different filters, keeping in mind that there are a maximum of 10 filters allowed. 
Next select the "Match type", in this case we have selected "IP adress matches regular expression", there are other choices as well including "IP address is in range (CIDR notation)" - look here to learn more about this match type - https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing.  In the "Value" field we have coppied in our IP address and then add "\" before the "." to make it clear that we mean a period "." in our IP Address.  (The period character means a single character wildcard, using the backslash, "\", escapes the period to indicate that we mean an actual period and not a wildcard.  We will be providing a brief Regular Expression article to provide the basics that will help your GA4 analysis.  To read more - https://en.wikipedia.org/wiki/Regular_expression

How to Create a Filter in GA4?

The next step is creating (or in most cases editing) your internal traffic filter.  First navigate to Admin -> under "Data Collection and modification" click on Data filters.  From here you can Edit your "Internal Traffic" filter, or click the "Create" button to start.  You will see this:

ga4 ip filtering internal traffic filter

If the "Data filter name" is not set fill in a unique name.  Next notice that the "Parameter name" is set to "traffic_type" and the "Parameter value" is set to "internal" - in most case we can leave these alone, if you want to create additional custom filters - then the Parameter and Value will allow you to customize these settings.

Finally we will want to select the "Active" filter state - this will ensure that the traffic is permanently filtered out.  (If you only want to filter the data from reports, but want the data available, try Report Filters - here is an introduction to Exclude Filters.)  When you are complete click on the "Save" button and then click on "save filter" on the next warning that filters are destructive and irreversable.  Make sure you test your filters - to ensure no data is lost.


Google Article on Filtering Internal Traffic - https://support.google.com/analytics/answer/10104470?hl=en

Google Article on Regular Expressions in Google Analytics - https://support.google.com/analytics/answer/1034324?hl=en

Published in Blog
Tagged under
Saturday, 22 April 2023 19:22

How do you GA4 Custom Channel Groups?


Google Analytics 4 (GA4) is the latest version of Google Analytics that offers a more intelligent, flexible, and privacy-focused analytics solution for businesses. GA4 comes with many advanced features that provide a better understanding of user behavior, customer journey, and website performance. One such feature is the ability to edit GA4 channels, which allows you to customize your reports and insights according to your business needs.

What are GA4 Channels?

Channels in GA4 refer to the sources of traffic that bring visitors to your website. These channels can be categorized into various types, such as organic search, direct, social, referral, email, and paid search. Each channel has its own set of characteristics and behaviors, which can help you identify the most effective marketing channels for your business.

Why Edit GA4 Channels?

Editing GA4 channels can help you gain deeper insights into user behavior and optimize your marketing campaigns. By customizing your channels, you can filter out unwanted traffic sources, combine similar channels, and create new channels that better reflect your business goals. This can help you focus on the most important metrics and make better-informed decisions about your marketing strategy.

How to Edit GA4 Channels?

To edit GA4 channels, you need to follow these steps (also see video following this article):
Step 1: Go to the Admin section of your GA4 property and select Data Settings.
Step 2: Click on "Channel Groups".
ga4 channel group editing

Step 3: To start from scratch you can create a new Channel Group or more often you will 'Copy to create a new' (in some properties you may see 'duplicate') the 'Default Channel Group':

GA4 copy channel group

Step 4: In the Edit Channel Group window, you can rename the channel group, change the rules for the channels included in the group, and add or remove channels from the group.
GA4 edit or modify channels
Step 5: To Create a new Channel - click on the "Add new channel" button.  Then on the next screen update the criteria for this new channel.  In our example traffic with a medium of either "magazine" or "newspaper" will be assigned to our "Magazine" Channel. 
To change the rules for the channels in the group, click on the ">" button next to the channe. This will open the Channel Details window, where you can set conditions for including or excluding channels based on various parameters such as source, medium, campaign, and more.
GA4 create a new custom channel
NOTE: The regular expression in this example uses the "|" symbol which represents and "OR" - so if our medium is "magazine" or "newspaper" the Channel will be "Magazine".
Step 6: After making the necessary changes, click on "Save channel" and then "Save" to save your new channel group.
Step 7: Once you have saved your changes, the new channel group will be available in your GA4 reporting views.

Tips for Editing GA4 Channels:

1. Before making any changes to your channel groups, make sure you have a clear understanding of your website traffic sources and user behavior. 
2. Use descriptive names for your channel groups to make it easier to identify them in your reports.
3. Experiment with different channel group configurations to find the one that works best for your business.
4. Regularly review and update your channel groups to ensure they accurately reflect your marketing strategy and goals.


Editing GA4 channels can help you gain deeper insights into user behavior and optimize your marketing campaigns. By customizing your channels, you can filter out unwanted traffic sources, combine similar channels, and create new channels that better reflect your business goals. Use the tips outlined above to make the most of your GA4 channel editing capabilities and improve your website's performance.


Google Article on Channel Groups - https://support.google.com/analytics/answer/6010097?hl=en#zippy=%2Cin-this-article

Google Article on Regular Expressions in Google Analytics - https://support.google.com/analytics/answer/1034324?hl=en

Published in Blog
Saturday, 02 March 2024 19:50

Google Analytics 4: The Ultimate UTM Guide

UTM Tagging Guide

UTM Inforgraphic TrioniaWelcome to our comprehensive guide on UTM tags, tailored specifically for digital strategists and marketers who are keen to elevate their analytics game. In this guide, we will dissect the world of UTM parameters to equip you with the knowledge necessary for diligent campaign tracking. Our aim is to enhance your understanding with straightforward explanations and practical advice, all in a professional yet relatable manner. Would love to hear your comments about tips and tricks you have used with using UTM parameters with your marketing.

What are UTM Tags?

UTM tags, also known as UTM parameters, are simple code snippets added to the end of a URL to track the performance of campaigns and content. UTM, which stands for "Urchin Tracking Module".  This comes from Urchin Software Corporation, which was acquired by Google to become Google Analytics!  These tags enable Google Analytics to capture granular details about where traffic comes from, offering insights into the effectiveness of your marketing efforts. 

The UTM tracking capability in Google Analytics is a great way to understand your website traffic and marketing effectiveness – the built in reports provide a great way to answer the questions that are typical for learning how a campaign performed and learn how to improve future campaigns.  Some of questions you can answer are:

  • How did our campaign perform? 
  • By new users, by conversions, by conversion rate...? 
  • Compared to prior campaigns?
  • What ad performed best?
  • What size, call to action, image variant...  worked best?
  • What time of day worked best (or worst)?
  • What channel attracts new visitors?  Drives user engagement?  Leads to clients?

In GA4 we can answer these questions using the built in Reports and the Explore reports.  For example the Acquisition report below we have selected the "Session source / medium" dimensions and the "Session campaign" secondary dimension - this report provides us a view of the detailed traffic sources as well as information about our Campaigns in particular our email campaigns:

The ultimate utm guide - GA4 acquisition report with session source, medium and campaign dimensions shown.

And from the Acquistion report we can dive into more detail about the 'Content' of the links in an email - using the utm_content tag which in turn populates the "Session manual ad content" field.  This field shows how each link in our email performs.  This utm_content tag can be extended to include information about an Ad variant, including colors, size, imagery...  To allow you to validate the performance of various ads.

explore report utm email content

It is these types of insights and more that show the benefit of understanding how people respond to campaigns and ads.  

What are the UTM Parameter Definitions?

The original five UTM parameters you can use to track your marketing campaigns are:

  1. `utm_source`: Identifies the source of traffic, such as a search engine, newsletter, or other referring site.
  2. `utm_medium`: Denotes the medium used to share the URL, like email, CPC, or social.
  3. `utm_campaign`: Specifies the individual campaign or promotion.
  4. `utm_term`: Used primarily for tracking keyword data for paid search campaigns.
  5. `utm_content`: Helps to differentiate similar content, or links within the same ad.

Each parameter provides valuable data points to understand how users interact with your digital strategy initiatives.

What are the new GA4 UTM Parameters?

GA4 has introduced a few new UTM Parameters that will further extned your ability to analyze and improve your digital marketing campaigns.  These new parameters are:

  1. `utm_source_platform`: Used to define the buying platform of the traffic - such as Search Ads 360, or other Demand Side Platform (DSP).
  2. `utm_creative_format`: Allows for finer differentiation of the creative - video, display, search, ...  (Not currently visible in GA4 reports.)
  3. `utm_marketing_tactic`: The specific marketing tactic in use for this campaign - lead gen, remarketing, upsell, ... (Not currently visible in GA4 reports.) 

This Google Analytics answer provides Google's detail about these parameters - https://support.google.com/analytics/answer/10917952.  We will provide more detail about each parameter in the examples and with links in the appendix.

The way to think about these parameters is to consider how they will answer your marketing questions and how to best utilize Google Analytics to answer these questions.  Trionia’s best practices incorporate this into our recommendations.  We also provide resources at the end of this 

What are the GA4 Default Channel Settings?

Google Analytics 4 (GA4) is the latest generation of Google's analytics offering, introducing a host of new features and changes. Understanding default channel groupings in GA4 is crucial for accurate data interpretation.

In GA4, default channels are predefined categories of traffic. When setting up UTM tags, aligning them with these default channel groupings will ensure consistent and understandable reporting metrics. Channels like 'Direct', 'Organic Search', 'Social', 'Email', and 'Affiliates' are some of the defaults that your tagged URLs will slot into for a streamlined analysis.  For the latest list see this Google Analytics Answer - https://support.google.com/analytics/answer/9756891?hl=en




Source = (direct) & Medium = (not set) | (none)

Organic Search

Medium = organic

Organic Social

Source matches a regex list of social sites


Medium = social | social-network | social-media | sm | social network | social media

Paid Social

Source matches a regex list of social sites


Medium matches regex ^(.*cp.*|ppc|retargeting|paid.*)$


Medium = email


Medium = affiliate


Medium = referral

Paid Search

Ad Distribution Network != Content

Medium = cpc | ppc | paidsearch


Campaign Name contains "cross-network"

Cross-network includes Demand Gen, Performance Max and Smart Shopping.

Paid Shopping

(Source matches a list of shopping sites


Campaign Name matches regex ^(.*(([^a-df-z]|^)shop|shopping).*)$)


Medium matches regex ^(.*cp.*|ppc|retargeting|paid.*)$

Other Advertising

Medium = cpv | cpa | cpp


Ad Distribution Network = Content

Medium = display | cpm| banner

 For the complete list of the Social, Search and Shopping source defintions used above see this table from Google - https://storage.googleapis.com/support-kms-prod/qn1xhBu8MVcZPIZ2WZMNdI40FtZXFPGYxj2K  

What are the UTM Tagging Best Practices?

To glean the most out of your UTM-tagged URLs, it's essential to adhere to some best practices:

  • Use consistent with naming conventions to simplify analysis and avoid confusion.  Use Google's Default Channel definitions and the same source and medium names.

    Understand that UTM parameters are case sensitive; 'Facebook' and 'facebook' will be tracked as separate sources.  We like to use all lower case.

    UTM links create new Sessions in GA4 and also impact all the Acquisition data.  To measure internal links use the flow reports of the Click Event which is already measured in the existing GA4 code.  This can be viewed in the Event reports as well as the Explore reports.

    Use UTM builder tools or tol defaults to ensure accuracy and save time.  Most Email and Social Media marketing tools provide UTM settings - set them up once and have consistent data going forward.

    • Never include sensitive or personal information in UTM tags.
    • Structure your campaign names systematically for easier analysis later on.  For example include dates to differentiate recurring campaigns, specific product or service names, ...
  • By sticking to these practices, your UTM data will be both meaningful and actionable.

What is the best UTM Tagging approach with Display Ads?

The following recommendations will place the Display ads in the 'Display" default channel as well as show the exact placements for further analysis of the ad results.

Campaign Name

Campaign names are most useful when they are descriptive name.  Campaign names can also be used across channels to determine the overall impact of larger communication/marketing efforts - for example "new product awareness" used in paid search could also be used in display and email campaigns.  (Could include media name in the campaign.)


A best practice is to use the source seen in organic and referral traffic - for example "nyt", "cnn" "hbo".


Recommend using the Google values seen in the prior table.  


Again descriptive names are most useful.  Two additional pieces of information to consider adding here is the media outlet and banner size.  For banner size - such as 300x250, 300x600, 728x90...  The result is a content parameter that looks like this - "kitten-picture-ver-a|media-people|300x250".


Not used for this channel.

The resulting URL would look something like this:


What is the best way to use UTM tags with Paid Social Ads?

Paid campaigns in social media can be tagged to provide more information than is provided by default - Source and medium.  It also allows you to track campaign data that if left untagged would come over in the Orcanic Social channel with a medium of "referral".

Campaign Name

Tying together campaigns used in other channels to social media communication help to understand how these channels work together - for example we can use the same campaign - "product-awareness-spring-2024".


Continue to use the default value that GA4 uses for Organic posts - such as facebook, twitter, linkedin.


When the posts are paid it helps to differentiate this in the reports, Trionia recommends using "cpc". "paid" or "paidsocial" for the medium.  Choose one different from the medium used for Banner Ads to simplify differentiating these values.  


Since social media posts are normally a combination of text and images a short title that also describes the image used is recommended.  Something like: "product-highlights|top-reasons-to-switch"


Not used for this channel.

A URL for a sample post:


For social media shorten the link to eliminate the chance that the parameters are removed by the social media outlet - the bitly (http://bitly.com).

How should Email Links use UTM Tags?

Tracking emails can be improved by tying to the Campaigns used in the other channels campaign goals. The content parameter can contain information about each link in an email to reflect the topics and images that promote user interaction.  (Some of this may be in place already - on analytics information was reviewed to create this document.)

Campaign Name

Tying together campaigns used in other channels with email communication help to understand how these channels work together - for example an email that includes a link to the Product details or Frequently Asked Questions can be a part of an overall campaign for product awareness.


Continue to use the source of the emails.  (Consider switching to lower case - if this is done, care will need to be taken to compare to historical data.)


The medium of 'email' is perfect for this channel.  


This parameter is perfect for describing the email subject.  EMails also contain additional articles and links, the content parameter is ideal for tracking these as well.  So the following "feb-2024-monthly-update-m" could be changed to - "feb-2024-update-subject", "feb-2024-update-product-faq", "feb-2024-update-product-features", 


Not used for this channel.

A URL for a sample post:


How do we use UTM Parameters with Bing Ads?

Use auto-tagging to ensure that you can track your Bing traffic.


 Further Resources

The Google UTM Builder Link - https://ga-dev-tools.appspot.com/campaign-url-builder/ 

Blog post by Annie Cushing - https://www.annielytics.com/guides/definitive-guide-campaign-tagging-google-analytics/ 

RaffleCopter blog post on UTM Naming Conventions - http://blog.rafflecopter.com/2014/04/utm-naming-conventions/

Published in Blog

How can we help?

To schedule a free Digital Marketing Consultation - Book Now 

Please type your full name.
Invalid email address.
Invalid Input
Invalid Input


Invalid Input