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:
β
Download the Template: First, download the GTM Amped Container Template: https://marketing-assets.amped.io/university/GTM-Container-Template-with-Amped-Events.json.zip
βNavigate to Import Container: Open your existing GTM container admin page and select "Import Container".
β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.
βPreview Changes: Preview the changes to ensure they are correct and compatible with your existing setup.
βUpdate Measurement ID: In the newly added tag, replace the existing Measurement ID with the one corresponding to your Google Analytics account.
β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
β
Navigate to Variables: Go to the "Variables" section in GTM.
βCreate a New Variable: Click "New" to add a new variable.
β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.
βChoose Configuration: For the configuration of the new variable, select "Data Layer Variable".
β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".
βRepeat: Follow these steps for each variable you need to create in GTM.
β
Setting Up a "Catch-All" Trigger in GTM
Navigate to Triggers: Go to the "Triggers" section in GTM.
βCreate a New Trigger: Click "New" to create a new trigger.
βName Your Trigger: Name your trigger and click on "Trigger Configuration".
βChoose Trigger Type: For the Trigger type, select "Custom Event".
βInput Event Name: In the "Event Name" field, input "Amped - (.*) " and select the 'Use regex matching' checkbox.
βAssign Trigger: The newly created trigger can now be assigned to your desired tag.
β
Configuring GA4 Events with Amped Event Information in GTM
Create a new GA4 Event Tag: Go to the "Tags" section in GTM and click on "New". Name the tag "Amped Event".
βSelect Tag Type: In the tag configuration, select "Google Analytics: GA4 Event" as the tag type.
βConfigure Event Name: Choose "Custom Event" for the event name.
βSet up the Trigger: Click on the triggering area under "Triggering" to attach the previously created "Catch-All" trigger to this tag.
βConfigure Event Parameters: Go to the "Event Parameters" section to define the event parameters.
βAdd Custom Variables: Add all the custom variables you created in the previous steps. These will be sent as parameters with the GA4 event.
β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.