Skip to content

Event Snippet

An event snippet is a small JavaScript call you place on a page β€” AnyTrack('trigger', '<EventName>', { attributes }) β€” that fires a standard or custom event with its event attributes. It runs on top of the automatic events the Tracking Tag already collects (PageView, OutboundClick, FormSubmit), letting you track actions the Tag can’t infer on its own, such as a button click, a video play, or a quiz completion.

Every AnyTrack event snippet has three parts: the trigger (the AnyTrack('trigger', …) command that generates the event), the event name (a standard event like Purchase or a custom name like Optin), and the event attributes (the customer, product, and transaction data passed in the object). Standard event names are mapped to each ad platform automatically; custom names must be mapped manually before a platform can optimize against them.

  • Tracking Tag β€” the single base script installed once in the page <head>; an event snippet is an extra trigger that needs the Tag loaded first.
  • Event Attributes β€” the data the snippet sends; the snippet itself is the code that sends it.

Add an event snippet only to the page where the specific action happens β€” the Tracking Tag handles page-wide automatic tracking everywhere else. When the snippet fires, AnyTrack records the event in the Conversion Report and forwards it server-side to every connected ad platform via the Conversion API. Validate a new snippet with the Tracking Tag Helper Chrome extension before relying on it. A server-side equivalent β€” sending the same event as a conversion payload to a webhook β€” covers actions that happen off the page.

Frequently asked questions

FAQ was last reviewed on 2026-06-25

Does an event snippet work without the Tracking Tag?
No. Every event snippet requires the Tracking Tag to be loaded in the page head first. If the snippet runs before the Tag finishes loading β€” common when the Tag is deployed through a tag manager β€” the event will not fire. Install the Tag directly in the head, or delay the snippet.
What does an event snippet return?
It returns a click_id value (for example MAbFl0fhrE5EfBu6fX0FnL02LfS) that you can push to your CRM to connect an offline conversion back to the original ad click.