Skip to main content
All CollectionsπŸ”Œ Integrations
DataLayer Events in Google Tag Manager from Amped + Google Analytics 4 (GA4) events
DataLayer Events in Google Tag Manager from Amped + Google Analytics 4 (GA4) events
Maggie Buchanan avatar
Written by Maggie Buchanan
Updated over a week ago

Amped automatically sends events to the Google Tag Manager (GTM) DataLayer and you can configure these events to trigger things like additional pixel tracking and to also send events to Google Analytics 4 (GA4). NOTE if your implementation of GA4 uses the full implementation with β€œgtag”, then Amped events should automatically show in GA4. This article shows how to add them manually via GTM to show in GA4.


In this article we’ll cover:

  • Overview of events sent from Amped to the GTM DataLayer
    ​

  • Handling DataLayer events from Amped

  • Using a GTM template of Events & Variables for Amped events
    ​

  • Manual setup of GTM events from Amped events

Overview of events sent from Amped to the GTM DataLayer

Amped sends events to Google Tag Manager’s DataLayer automatically for all campaigns in Amped. Here’s an overview of the types of events sent to the DataLayer from Amped

  • Amped - Impression
    Sent when a visitor sees a campaign

  • Amped - Email Captured
    ‍
    Sent when an email is captured

  • Amped - Phone Number Captured
    Sent when a phone number is captured

  • Amped - Tap to Text Clicked
    ‍
    Sent when someone clicks a β€œTap to text” button for SMS

  • Amped - {{$input name}} captured
    Sent for ALL other data types using the name of the input field. eg: birthdayname, zip, etc.

  • Amped - Button Clicked
    Sent when a button is clicked

  • Amped - Experiment Group Chosen
    Sent when a visitor is part of a control or experiment group (currently a beta feature, more on this soon)

  • Amped - Custom Event
    Sent for any additional events you set in a Campaign

Handling DataLayer events from Amped

Now that you know how Amped sends events to the GTM DataLayer, you can now use those custom events to trigger off other actions in GTM like triggering a conversion pixel to track an email sign up or sending events into GA4 (if you don’t already have gtag on the site).
​

Using a GTM Template for Amped Events & Variables

We have created a custom "Container" template for GTM that you can import into your existing GTM container. This template automatically recognizes Amped DataLayer Events and Variables and also configures them to be sent to GA4.
​

To utilize this Amped GTM Container Template, follow these steps:
​

  1. Download the Template: First, download the GTM Amped Container Template: https://marketing-assets.amped.io/university/GTM-Container-Template-with-Amped-Events.json.zip
    ​

  2. Navigate to Import Container: Open your existing GTM container admin page and select "Import Container".
    ​

  3. Upload the Template: Upload the JSON Container Template you downloaded in Step 1. Ensure to select "Existing Workspace" so it gets added to your existing GTM container. Choose the "Merge" option and "Overwrite Conflicts" to successfully merge the template with your container.
    ​

  4. Preview Changes: Preview the changes to ensure they are correct and compatible with your existing setup.
    ​

  5. Update Measurement ID: In the newly added tag, replace the existing Measurement ID with the one corresponding to your Google Analytics account.
    ​

  6. Publish: Once everything is checked and confirmed, finalize the updates and publish the new workspace.

Congratulations! πŸŽ‰ You've now successfully imported a template container that has set up Events and Variables in your GTM container, which are also sent to Google Analytics. This will help streamline your analytics processes and improve data consistency.

‍

Manual setup of GTM events from Amped events

If you would prefer to setup the Events and Variables by hand, here are steps to add the Variables to GTM and then also the Events that are sending to the DataLayer from Amped and use them inside of GTM.
​

Setting Up Variables in GTM

List of Variables used in Amped DataLayer Events

  • Name: Amped - Account ID
    DataLayer Variable Name: amped.accountId

  • Name: Amped - Campaign ID
    DataLayer Variable Name: amped.campaignId

  • Name: Amped - Campaign Name
    DataLayer Variable Name: amped.campaignName

  • Name: Amped - Variation ID
    DataLayer Variable Name: amped.variationId

  • Name: Amped - Variation Name
    DataLayer Variable Name: amped.variationName

  • Name: Amped - Step Number
    DataLayer Variable Name: amped.stepNumber

  • Name: Amped - Step Name
    DataLayer Variable Name: amped.stepName

  • Name: Amped - Label
    DataLayer Variable Name: amped.label

  • Name: Amped - Click info
    DataLayer Variable Name: amped.clickInfo

  • Name: Amped - Event Category
    DataLayer Variable Name: amped.eventCategory

  • Name: Amped - Event Action
    DataLayer Variable Name: amped.eventAction

  • Name: Amped - Event Label
    DataLayer Variable Name: amped.eventLabel

  • Name: Amped - Event Value
    DataLayer Variable Name: amped.eventValue
    ​

  1. Navigate to Variables: Go to the "Variables" section in GTM.
    ​

  2. Create a New Variable: Click "New" to add a new variable.
    ​

  3. Name Your Variable: Give it a relevant name, such as "Amped - Account ID". Remember, for each variable sent from Amped, a corresponding variable needs to be created in GTM.
    ​

  4. Choose Configuration: For the configuration of the new variable, select "Data Layer Variable".
    ​

  5. Enter DataLayer Variable Name: Enter the corresponding DataLayer Variable Name. This should be in the overview of Variables and typically has the format "amped.campaignName".
    ​

  6. Repeat: Follow these steps for each variable you need to create in GTM.
    ​

Setting Up a "Catch-All" Trigger in GTM

  1. Navigate to Triggers: Go to the "Triggers" section in GTM.
    ​

  2. Create a New Trigger: Click "New" to create a new trigger.
    ​

  3. Name Your Trigger: Name your trigger and click on "Trigger Configuration".
    ​

  4. Choose Trigger Type: For the Trigger type, select "Custom Event".
    ​

  5. Input Event Name: In the "Event Name" field, input "Amped - (.*) " and select the 'Use regex matching' checkbox.
    ​

  6. Assign Trigger: The newly created trigger can now be assigned to your desired tag.
    ​

Configuring GA4 Events with Amped Event Information in GTM

  1. Create a new GA4 Event Tag: Go to the "Tags" section in GTM and click on "New". Name the tag "Amped Event".
    ​

  2. Select Tag Type: In the tag configuration, select "Google Analytics: GA4 Event" as the tag type.
    ​

  3. Configure Event Name: Choose "Custom Event" for the event name.
    ​

  4. Set up the Trigger: Click on the triggering area under "Triggering" to attach the previously created "Catch-All" trigger to this tag.
    ​

  5. Configure Event Parameters: Go to the "Event Parameters" section to define the event parameters.
    ​

  6. Add Custom Variables: Add all the custom variables you created in the previous steps. These will be sent as parameters with the GA4 event.
    ​

  7. Save and Publish: Click on "Save" to save your tag and then "Publish" your GTM container for the changes to take effect.

Need to send custom events to theGA4 throughGTM DataLayer?

If you've already configured your GA4 with the GTM template container above (which allows you to send any event with "Amped - *") then the below code will allow you to pass events to GTM that will also pass to your GA4 events:
​

// Start Custom code here

if (window.dataLayer) {
window.dataLayer.push({
"event": "{{NAME YOUR EVENT HERE}}",
//"category": "Button Click", // optional
//"action": "Click", // optional
//"label": "Custom Code Button", // optional
//"value": 1, // optional
//"customKey": "customValue" // optional you can add any custom key-value pair
});
}

resolve(); // resolve(); tells your ad to continue. Othwerwise the ad will load indefinitely, break, and it will timeout.
Did this answer your question?