Custom Event Tracking

Learn how to trigger standard and custom events on your website.

Sometimes you need more control over which events get triggered on your website and when. AnyTrack TAG supports trigger standard and custom events programmatically as needed.


Coding skills required

Trigger custom events requires HTML and JavaScript skills. Please contact a web developer if you don’t feel comfortable doing that yourself.



The event snippets below only work if the AnyTrack tag is set on the head of your website.

The Trigger Command:

The AnyTrack Event Snippet is composed of three arguments:

  1. The Trigger: The command that generates the event.
  2. The Event Name: Standard or Custom event name.
  3. The Event Attributes: Contextual data giving more information about the actual event.
  var click_id = AnyTrack('trigger', 'ViewContent');


Good to know

The return argument is the event click_idvalue such as MAbFl0fhrE5EfBu6fX0FnL02LfS which can be pushed to your CRM in order to track offline conversions.


Event Mapping

AnyTrack Standard events are automatically mapped to ad platforms standard events. For example, when AnyTrack tracks a Purchase event, it is automatically sent to Facebook Purchase event.

Trigger Custom Events

If you need more flexibility on the naming convention for your events, you can use custom event names using the following snippet:

// trigger an optin event  
var click_id = AnyTrack('trigger', 'Optin');

Conversion event mapping

Once you've added your custom event snippets on your website and they are triggering according to your event mapping.


Good to know:

When AnyTrack Event Snippet fires, it automatically sends the same event name to your ad pixel.

Event attributes

It is recommended to send additional attributes with standard or custom events in order to enrich your pixels with granular data points.

// trigger an optin event  
var click_id = AnyTrack('trigger', 'Optin', {
  formId: 'form82323',
	brand_name: 'newsletter',
	email: '[email protected]'

For example, you can send event attributes such as brand_name or transaction_id which will then be available in AnyTrack as well as in your ad platforms.

:arrow-right: Check out the complete list of supported Event Attributes.