Create an event
This article describes how to create an event.
Manage events either from the Events screen or from the expanded Tag Details screen.
Create an event listener in three steps: Select an event type, configure the event, and create event rules.
Step 1: Select an event type
- Go to Events and click + New Event.
- In the Event Type step, select the type of event that you want to track.
- Click Next.
Step 2: Configure the event listener
- In the Configuration step, enter a Name for the event listener.
- (Optional) Enter Notes about this event listener.
- Under Scope, select a scope from the list to determine when the event listener initialization code runs on the page. We recommend that you use the DOM Ready scope.
- Under Tracking Event, select the tracking event for the event listener from the list. if you plan to subscribe a tag to this event listener, be sure to select a tracking event that is supported by the tag, or the event listener will not work with that tag.
- View – Track when a visitor views a page.
- Link – Track when a visitor interacts with a page, such as clicks, video scrolls, etc.
- Custom – Enter a custom tracking event in the text box (for example,
video
).
- Under Publish Locations, select the publish locations for the event.
- In the Element Selector box, enter the element ID, class, or selector of the item you want to target. For more information about how to determine an element selector, see How to Determine the CSS Selector of an Element.
- Under Event Triggers, select the event triggers for this event and set the thresholds for those triggers. For more information about each event type event trigger, read the documentation from our list of Event Types .
- Under Trigger Frequency, select whether you want to track every time that event listener is triggered on a page (Always) or track only the first time an event is triggered (Once).
- Configure the trigger variables for the event listener. These are the values sent with the event listener tracking call. You can edit existing trigger variables or add new ones to collect additional data with the visitor actions. For more information about event type event trigger variables, read the documentation from our list of Event Types.
- When you are done configuring the event listener, click Next.
Step 3: Create rules
-
In the Rules dialog, set the rules that determine if a page loads your new event listener. The left side of the dialog displays the logic the page uses for loading the event listener. The right side of the dialog lists all the available rules on the profile that you can reuse for this event listener.
-
To create a new rule, click + Add Rule. For information about how to create and configure a rule, see Load Rules.
-
Build the logical conditions for the event listener by dragging and dropping the rules from the list on the right side of the dialog to the logic boxes on the left side. For more information about logical operators and load rules with events, see Event Rules Examples.
If you do not select any rules, the event listener loads and listens on every page. This can cause performance issues for your visitors as well as your data collection.
-
When you are done arranging the rules for your event, click Save.
To save your work to the profile, click Save/Publish.
Tags with events
After you create an event listener, you can subscribe a tag to the event listener in the Rules and Events section for a tag. Precisely control when a tag fires and when the data that is sent to the tag endpoint by combining load rules for a tag and an event listener conditions.
For more about tags and event listeners, see Subscribe a tag to an event.
Duplicate an event
Duplicate an event listener to create a copy of it in the profile. For example, if you have a mouseover event with a complex set of rules that you want to apply to another element on a page, duplicate that event listener and change the Element Selector in the duplicate to the new element.
- From the Events screen, click the event you want to duplicate.
- In the Event Details slideout, click Duplicate.
- Click the duplicate event in the Events dashboard.
- In the Configuration tab, click Edit.
- Enter a unique name and customize settings for the event listener.
This page was last updated: January 30, 2023