Custom Event Tracking

Learn how to track custom events like button clicks, form views, and video plays using the AnyTrack Event Snippet. Covers the trigger command, standard and custom event names, event attributes for enriching conversion data, automatic event mapping to ad platforms, and validation using the Tracking Tag Helper extension.

Track specific user actions—like button clicks, form views, or video plays—that matter most to your campaigns. Custom events give you complete control over what gets tracked and when, so ad platforms receive the exact signals they need to optimize performance.

****

Custom event tracking requires HTML and JavaScript knowledge. If you are not comfortable with code, share this guide with your developer.

Before you begin

  • The AnyTrack tracking tag is installed on your website
  • You have HTML and JavaScript knowledge
  • You have an active AnyTrack property

The Trigger Command

Every AnyTrack event snippet has three parts:

  1. The Trigger: The command that generates the event.
  2. The Event Name: Standard event (like ViewContent, Lead, Purchase) or custom event name.
  3. The Event Attributes: Customer data (email, phone), product details (SKU, value, currency), and other context that enriches your tracking. See the complete list of Event Attributes.
<script>
  var `click_id` = AnyTrack('trigger', 'ViewContent', {
      brand: 'Nike',
      label: 'shoes',
      value: 199.00,
      currency: 'USD'
  });
</script>
📘

Track

The snippet returns a click_id value (like MAbFl0fhrE5EfBu6fX0FnL02LfS) that you can push to your CRM to connect offline conversions back to the original ad click.

****

Standard events like Purchase, Lead, or ViewContent are automatically mapped to each ad platform's equivalent event. When AnyTrack tracks a Purchase event, Facebook receives it as a Facebook Purchase event, Google receives it as a Google purchase conversion, and so on.

Trigger Custom Events

Use custom event names when standard events don't match your tracking needs:

<script>
var `click_id` = AnyTrack('trigger', 'Optin');
</script>

Conversion Event Mapping

Standard events are automatically forwarded to ad platforms. Custom events require manual mapping—follow our guide to map custom events to your ad networks so platforms can use them for optimization.

Event Attributes

Send customer data and product details with every event to boost Event Match Quality and give ad platforms the rich signals they need to optimize effectively. Higher Event Match Quality means better attribution, smarter targeting, and improved ROAS.

<script>
var `click_id` = AnyTrack('trigger', 'Optin', {
  formId: 'form82323',
	brand: 'newsletter',
	email: '[email protected]'
});
</script>

Attributes like email, phone, value, currency, and transaction_id flow to AnyTrack and all connected ad platforms—giving you consistent, enriched data everywhere.

See all supported Event Attributes.

Validate Your Custom Events

Catch tracking issues before they cost you money. Validation takes 30 seconds using the AnyTrack Pixel Helper Chrome Extension.

Step 1: Verify the snippet is found

Navigate to the page where you added the snippet, open the AnyTrack Pixel Helper Chrome Extension, and click "Snippets found." Your custom event snippet should appear in the list.

The AnyTrack Pixel Helper Chrome Extension shows all the event snippets found on the page.

The AnyTrack Pixel Helper extension shows all event snippets found.

Step 2: Confirm the event fired

On the same page, check the Tracking Tag Helper again. A green checkmark with timestamp means the event triggered successfully. Click the ClientId link to view details.

Click the ClientId link to see the event in the Conversions Report.

if successful, the event and its identifiers will be visible.

Step 3: Review in Conversions Report

The ClientId link opens the Conversions Report showing your triggered event. Verify the event data looks correct, then map the event to your connected ad networks so they can receive and use the conversion signals.

The Conversions Report will show the events triggered by the snippet code.

The Conversions Report will show the events triggered by the snippet code.

Troubleshooting: Event Not Triggering

If the AnyTrack Pixel Helper shows both the Tag and the event snippet are installed but the event is not firing, the snippet is likely executing before the Tag finishes loading. This commonly happens when the Tag loads through a tag manager.

Solution 1: Configure your tag manager to fire the event snippet after the AnyTrack Tag loads completely.

Solution 2: Install the AnyTrack Tag directly in your page <head> section instead of through a tag manager — this guarantees it loads before your event snippets.

Solution 3: Add a delay to the snippet, giving the Tag time to load:

<script>
  var delay = 2000; // Delay in milliseconds (2 seconds)
  function triggerAnyTrack() {
    var `click_id` = AnyTrack('trigger', 'SignUp');
  }
  setTimeout(triggerAnyTrack, delay);
</script>

FAQ & Troubleshooting

FAQ was last reviewed on 2026-02-21

Standard events like Purchase, Lead, and ViewContent are automatically mapped to each ad platform's equivalent event. Custom events use your own names and require manual mapping in your ad platform. See custom event mapping for setup instructions.
No. Add event snippets only to pages where the specific action occurs. The AnyTrack Tag handles automatic tracking (page views, outbound clicks, form submissions) across all pages.
Use the AnyTrack Pixel Helper Chrome extension to verify the snippet is found and the event fires. Then check the Conversions Report in your dashboard to confirm the event data.