Advanced: UET Custom Event and Variable Revenue reporting via GTM
There are a few things you need to do before you set up a custom event and variable revenue reporting using Google Tag Manager (GTM.)
- First, read up on - GTM Variables, Built-In Variables, Tags and Triggers
- Read our help on custom events & variable revenue to understand how they work
- Make sure you added the UET tag tracking code to your website. Passing custom events and variable revenue from a webpage requires additional code to be added to the webpage. But first you must have the UET tag added to your website via GTM.
If you want to pass UET custom events and/or variable revenue via GTM, you need to do the following in GTM:
Set up GTM Variables to read dynamic values from your page
- Variables are name-value pairs for which the value is populated during runtime.
Set up the Trigger for when to report UET custom events/revenue
- Triggers attached to a tag govern when the tag is fired or not fired.
- A tag must have at least one trigger to fire. Triggers are evaluated during runtime and associated tags are fired (or not fired) when the trigger conditions are met.
Our GTM samples webpage source code has the following 5 variables
These we are reading into our GTM by creating new user defined variables
Create a new User-Defined Variable from New in the Variables page.
Define Global Variable Name, this variable need to same as in your website's code.
Now, repeat above steps and create a new variable for each custom event that you want to track. In this example, we created 5 variables to track custom events and variable revenue.
- Create a new User-Defined Variable from New in the Variables page.
- Our GTM samples webpage source code has the following 5 variables
Set up a new Trigger (b. above) by Clicking New on Trigger page. In our example, we have set up the trigger as the click on a button on our sample page (with id=btnCustomEvent)
Now create a Tag and add newly created variables (Step 1) and trigger (Step 2) to report customer event or variable revenue.
Publish the changes from your Workspace.
Verify you have update your website’s source code to report custom events and variable revenue.
- Step 6. Validate tag is working correctly using UET Tag Helper, confirm variable revenue and custom events are being fired.