How to add GA Events to Tag Manager


If you use Google Analytics (GA) tracking code, we recommend creating and using onclick event tracking code. However, if you use Google Tag Manager (GTM) to deliver your GA tracking code, there's no need to add extra code to your links. This tutorial will show step-by-step how to add event tracking code using GTM.

1. Enable "Click URL"

In GTM, click on Variables in the side navigation, then the Configure button and then make sure Click URL is checked.

Variable Click URL

2. Create New Trigger

Click on Triggers in the side navigation and then click on the New button. Click anywhere on the Trigger Configuration card and then click on Just Links in the Click section.

Choose Event Click

Leave Wait for Tags and Check Validation unchecked. Click on Some Link Clicks in the This trigger fires on section. Select Click URL and then ends with. Enter the unique part of the link. Make sure you match the end of the link exactly. For example, if it has a slash at the end, add it. If it doesn't, leave it out. Otherwise the trigger may not fire.

Fire Trigger

Name the Trigger and save it.

3. Create New Tag

Click on Tags in the side navigation and then click on the New button. Click anywhere on the Tag Configuration card and then click on Universal Analytics.

Google Analytics Product

Enter your GA Tracking ID. Then select Event as the Track Type. Finally, enter your tracking parameters (AKA campaign variables).

Configure Tag

Click anywhere on the Triggering card and then click on the trigger you created in the second main step of this tutorial. Name the Tag and save it. Finally, publish your changes. After you publish the new version of your GTM, visitors who click on the link you specified will automatically trigger and create a new Event in GA.