The custom event trigger is used to track interactions that occur on your website or mobile app that aren't handled by standard methods. The most common use is when you want to track form submissions, but the default behavior for the form has been altered (e.g. the submit
browser event has been overridden.)
To create a new custom event trigger:
- Click Triggers New.
- Click Trigger Configuration and choose the Custom Event trigger type.
- Enter an event name. Select "use regex matching" to allow this field to handle regular expressions.
Example configuration
Here is an example web configuration that will fire a tag when a custom event called 'button1-click' is pushed to the data layer:
- Add code that will push the event into the data layer when the button is clicked:
<a href="#" name="button1" onclick="dataLayer.push({'event': 'button1-click'});">Button 1</a>
- Create a new custom event trigger. In the Trigger Configuration section of your new tag, use these settings:
Event name: button1-click
This trigger fires on: All Custom Events
When this trigger is applied to a tag, the tag will fire even when the default submit event is overridden. When the specified button is clicked, a custom event with the value of button1-click is pushed to the data layer. Tag Manager then detects button1-click as a custom event value, and will proceed to fire the tag.
Use dataLayer.push()
to send multiple variables together with the event. For example: Send a conversion value with the custom event name:
dataLayer.push({'event':'button1-click','conversionValue':25});
Create the data layer variable in Tag Manager and use this variable in the conversion value field of your Google Ads conversion tracking tag.