Set up event tracking with Google Tag Manager (GTM)
To get statistics for your nudges in your GA when also using GTM, you have to set up a selection of event handlers. This is due to GTM blocking events through to GA without these handlers.
First off we create a trigger. Give it a name, this will be the main event name. Ex: Kindly Nudge Trigger.
Next up, click on Trigger Configuration, and select Custom Event. The event name has to be rck_event. This is because we need to call this from the script.
After this, just save the trigger, and move on to the next step.
We have to create three variables, one for each of the event tracking variables built into GA: action, label and category. Therefore we have to do this process three times.
Start off with creating a variable and name it: Kindly eventCategory / Kindly eventAction / Kindly eventLabel. Then click on Variable Configuration.
Choose dataLayer variable from the list and name it: eventCategory / eventAction / eventLabel.
Repeat this process for all three, then move on to the last step.
Lastly we have to create the tag to get this to run on events. This all ties together by the tag firing on the event of Nudge open or close. When that happens it fires an event to GA from GTM. So:
Create a new tag and name it: Kindly Nudge Tag. Click on Tag Configuration and choose the GA type you have on your website. For this guide we will be using Universal Analytics.
Then we need to set up the variables. Choose Event as Track Type. Then, fill in your variables by clicking on the Add variable button, matching up the names for them.
Remember to set up your Analytics settings. You can override the settings with a GA-ID underneath.
Click on Triggering and select the trigger we created earlier. That's it, but:
Don't forget to publish your changes.