Skip to main content

Create Tags in Google Tag Manager (GTM)

Set up tags in GTM to track user interactions on your website and send relevant data to Google Analytics 4 (GA4)

Maddy avatar
Written by Maddy
Updated this week

Tags in Google Tag Manager (GTM) allow you to track user activity on your website and send key data to Google Analytics 4 (GA4). This step-by-step guide will walk you through how to set up your GTM tags correctly.

Jump To...

Create a Google Analytics (GA4) Account and Locate the Measurement ID

Before setting up tags in GTM, make sure you have a Google Analytics account with a GA4 property already created. You'll need your GA4 Measurement ID later. Follow the steps below to locate your Measurement ID.

  • Go to the Admin tab on the lower left-hand corner of your Google Analytics account

  • Under Data Collection and Modification, select Date Streams

  • If you haven't already done so, set up a data stream

    • Click Add Stream on the upper right-hand corner

    • Select Web

    • Enter your GivingFuel account URL (see note below)

    • Add a stream name for your GivingFuel account

    • Click Create and Continue

Note: For GivingFuel, you will only use the name of the account with the product name. You will NOT add a specific page name. The URL should be in the format https://subdomain.givingfuel.com

Here is how to find the correct URL for your data stream.

  • From the Pages screen, click the arrow icon in the upper right-hand corner of one of your published pages

  • Find your URL

  • Copy the URL until you reach givingfuel.com - do not copy anything after givingfuel.com

  • Once the data stream has been created, select the data stream

  • Under Stream Details, find the Measurement ID (this will be needed later)

Pro Tip: On your data stream, we recommend keeping the settings under Events and Google Tag standard unless you are confident in customizing them.

By default, Google Analytics 4 automatically tracks several key events, including:

  • Page Views: Triggered when a user visits your page

  • Scrolls: Logged when a user scrolls about 70% down the page

  • Form Interactions: Captured when a user clicks into a form field on your page


Create Variables in Google Tag Manager (GTM)

With your GA4 Measurement ID in hand, log into your Google Tag Manager (GTM) account. From there, you’ll begin by creating your variables within GTM. In GTM, variables store and pass data from the Data Layer in your GivingFuel page to Google Analytics.

  • On the left-hand side of Google Tag Manager, click Variables

  • Under User-Defined Variables, click New

  • Click the brick icon (don't title the variable yet)

  • Under Page Variables, click Data Layer Variable

  • Under Data Layer Variable Name, add the name for your variable. NOTE: We recommend adding the variable name in all lowercase, as this is how the name is formatted in the data layer

  • Keep the Data Layer Version on the default value

  • *References to this Variable will be added later

  • In the top left corner, title your variable (see tip below)

  • Click Save

Pro Tip: When naming your variable, a helpful convention is to use the format "DLV - [variable name]". For example, if you're adding a variable for "currency," name it "DLV - currency". This makes it easier to identify and manage them later. DLV is short for Data Layer Variable.

We recommend setting up the following data layer variables in GTM

Variable

Variable Type

Data Layer Variable Name

Notes

Currency

Data Layer Variable

currency

This variable pulls the currency of the transaction.

Items

Data Layer Variable

items

This variable displays each item and its price. It is the major array name with sub-array data.

Transaction ID

Data Layer Variable

transaction_id

This variable in Google Analytics pulls the Order ID from your GivingFuel transaction. This helps you match GA4 data with specific donations in GivingFuel.

Value

Data Layer

Variable

value

This variable represents the total cost of the order and is the amount recorded in GA4 and Google Ads.

Note: When entering the Data Layer Variable Name, use all lowercase letters. This matches the formatting used in the data layer and ensures the variable is recognized correctly.


Create the Tags in Google Tag Manager (GTM)

After creating your data layer variables, the next step is to set up your tags in GTM. We recommend configuring two tags within GTM.

Create the GA4 Config Tag

  • Go to the Tags page in GTM and click New

  • Under Tag Type, add the type Google Tag

  • Enter the Measurement ID you found earlier in Google Analytics (FINALLY!!!)

  • Under Triggering, create a firing trigger of Initialization - All Pages

  • Click Save

Create the GA4 Purchase Event Tag

  • Go to the Tags page in GTM and click New

  • Tag Configuration

    • Under Tag Type, select Google Analytics: GA4 Event

    • Enter your Measurement ID (Click here to find the Measurement ID)

    • In the Event Name field, type purchase. NOTE: Type "purchase" in all lowercase to match the data layer format

  • Event Parameters

    • Under Event Settings Variable, select None

    • Click Add Parameter four times.

      • Under the Event Parameter column, type the name of the variable in all lowercase

        • Event Parameter: value

        • Event Parameter: transaction_id

        • Event Parameter: currency

        • Event Parameter: items

      • Under the Value column

        • Click on the brick icon

        • On the next screen, you are selecting the variables you previously created

        • Match the Event Parameter name to the Value name


  • More Settings

    • Set Send Ecommerce data to Yes

    • Under Data source, select Data Layer

  • Set the Trigger

    • Select to create a new trigger

    • Under Trigger Type, select Custom Event

    • Under Event Name, type purchase, all lowercase

    • Name the trigger (Ecommerce | Purchase)


  • Click Save, and the final display should look like this


Test Your Page

After setting up your variables, tags, and triggers, preview and test your setup using GA4's Debug mode and GTM's Preview Mode. Once confirmed, publish your changes and monitor events in Google Analytics to ensure data is being tracked correctly. This completes your purchase tracking setup, enabling accurate e-commerce conversion measurement in GA4.

  • Go to your GivingFuel account

  • From the Pages screen, click the pencil icon under the page you want to edit

  • Go to the Settings tab from the top menu bar

  • Select Tracking

  • Turn on Google Tag Manager

  • Enter your GTM ID

  • Publish your GivingFuel page

  • Copy your GivingFuel URL

  • Go back to GTM

  • Click the Workspace tab, and click Preview

  • Paste your GivingFuel URL

  • Go to Google Analytics

  • Navigate to the Admin tab

  • Under Data Display, select Debug View

  • Go to your published GivingFuel page, and test the donation experience and confirm that the data is flowing in GTM and GA4 as expected

Pro Tip: To test the GTM and GA4 tags, you must use a live, published page. Users cannot use the preview mode to test GTM and GA4.

  • Once you have tested the page and your data is flowing as needed, publish your changes

  • Monitor the events in Google Analytics to ensure the data is being received correctly

Did this answer your question?