# Tracking Tag vs Event Snippet

> Understand what the AnyTrack Tracking Tag does, what an event snippet does, and how the two work together to track conversions.

What is the difference between the AnyTrack Tracking Tag and an event snippet? Both are JavaScript that runs on your website, and that is where the similarity ends. The **Tracking Tag** is the base script you install once in your site's `<head>`: it opens sessions, collects attribution data, and tracks page views, form submissions, and outbound clicks automatically on every page. An **event snippet** is a small extra trigger you place on a specific page to record an action the Tag cannot detect on its own, such as a button click or a video play. Every event snippet depends on the Tracking Tag being loaded first.

## What the Tracking Tag Is

The [Tracking Tag](/docs/anytrack-tag) is AnyTrack's own client-side script, unique to each property. You [install it once](/docs/install-anytrack-tag) in the `<head>` section of every page in your funnel, and from there it works page-wide without any extra code:

- Opens the session and assigns the Client ID, the first-party cookie that anonymously identifies the visitor.
- Generates the Page Click ID (`atclid`) on page load and a Click ID for each trackable element.
- Collects UTM parameters and referrers as first-party data for attribution.
- Runs AutoScan, AutoTrack, and AutoTag to find trackable links and forms and append the Click ID automatically.
- Tracks `PageView`, `OutboundClick`, and `FormSubmit` events on its own.
- Loads your connected ad platform pixels (Meta Pixel, Google Tag) with the right identifiers.

You never write the Tracking Tag yourself. Copy it from **Property Settings** under the **Tracking Script** tab and paste it into your site.

## What an Event Snippet Is

An event snippet is a single JavaScript call that fires one event, with the data you choose to attach. It runs on top of the automatic events the Tracking Tag already collects. Every snippet has three parts: the trigger command, the event name (a [standard event](/docs/standard-events) like `Purchase` or a custom name like `Optin`), and the [event attributes](/docs/event-attributes) that enrich the conversion with customer and product data.

```javascript AnyTrack Event Snippet
<script>
  var click_id = AnyTrack('trigger', 'ViewContent', {
      brand: 'Nike',
      label: 'shoes',
      value: 199.00,
      currency: 'USD'
  });
</script>
```

The snippet returns a `click_id` value that you can push to your CRM to connect an offline conversion back to the original ad click.

Unlike the Tracking Tag, an event snippet belongs only on the page where the action happens. Standard event names are mapped to each ad platform automatically; custom names require manual mapping before a platform can optimize against them. The full setup is covered in [Custom Event Tracking](/docs/custom-events).

## Tracking Tag vs Event Snippet at a Glance

| | Tracking Tag | Event snippet |
| :--- | :--- | :--- |
| What it is | AnyTrack's base client-side script | A one-line trigger call: `AnyTrack('trigger', ...)` |
| Job | Foundation: sessions, IDs, attribution data, automatic events, pixel loading | Fires one specific event you define |
| Where it goes | The `<head>` of every page | Only the page where the action happens |
| How many you need | One per property | One per action you want to track |
| Who writes it | Generated by AnyTrack in Property Settings | You or your developer |
| Events it tracks | `PageView`, `OutboundClick`, `FormSubmit` automatically | Any standard or custom event, with attributes |
| Depends on | Nothing; it is the foundation | The Tracking Tag must load first |

**Bottom line**: the Tracking Tag is mandatory for every AnyTrack setup; event snippets are optional extras you add when the automatic events do not cover an action you care about.

## Why Every Snippet Needs the Tag

The Tracking Tag initializes the `AnyTrack` function that every event snippet calls. Without the Tag on the page, the snippet has nothing to talk to, so the event never reaches AnyTrack.

Timing matters too. If a snippet executes before the Tag finishes loading, the event does not fire. This happens most often when the Tag is deployed through a tag manager, which adds a loading delay. Install the Tag directly in the page `<head>`, configure your tag manager to fire the snippet after the Tag loads, or add a short delay to the snippet. The [Custom Event Tracking](/docs/custom-events) guide walks through each fix.

<Callout icon="📘" theme="info">
**Note**

Validate any new event snippet with the <a href='/docs/anytrack-chrome-extension'>Tracking Tag Helper Chrome extension</a> before relying on it. It shows the snippets found on the page and confirms whether each event fired.
</Callout>

## When You Need an Event Snippet

- **You need one** for on-page actions the Tag cannot infer: button clicks, video plays, quiz completions, or a custom funnel step unique to your business.
- **You do not need one** for page views, form submissions, or outbound clicks. The Tracking Tag tracks these automatically on every page.
- **You do not need one** for conversions from connected integrations. Platforms like Shopify or your affiliate networks send purchases and leads to AnyTrack server-side.
- **Use a webhook instead** when the action happens off the page, such as a sale closed in your CRM. Sending the conversion server-side covers what no on-page script can see.

<FaqAccordion
  title="FAQ"
  items={[
    {
      question: "Do I need an event snippet if the Tracking Tag is already installed?",
      answer: "Only for actions the Tracking Tag does not track automatically. The Tag records page views, form submissions, and outbound clicks on its own, and connected integrations send conversions like purchases server-side. Add a snippet when you want to track a specific on-page action such as a button click or a video play."
    },
    {
      question: "Does an event snippet work without the Tracking Tag?",
      answer: "No. Every event snippet calls the AnyTrack function that the Tracking Tag creates, so the Tag must be loaded in the page head first. If the snippet runs before the Tag finishes loading, the event will not fire."
    },
    {
      question: "Should I add event snippets to every page?",
      answer: "No. Add a snippet only to the page where the specific action occurs. The Tracking Tag handles automatic tracking across all pages, so duplicating snippets site-wide creates noise without adding data."
    },
    {
      question: "What does an event snippet return?",
      answer: "It returns a <code>click_id</code> value that you can push to your CRM. This lets you connect an offline conversion, such as a closed deal, back to the original ad click for attribution."
    },
    {
      question: "Why is my event snippet not firing?",
      answer: "The most common cause is the snippet executing before the Tracking Tag finishes loading, which often happens when the Tag is deployed through a tag manager. Fire the snippet after the Tag loads, install the Tag directly in the page head, or add a short delay. See the <a href='/docs/custom-events'>Custom Event Tracking guide</a> for each solution."
    }
  ]}
/>

## Next Steps

<Cards columns={2}>
  <Card title="Custom Event Tracking" href="/docs/custom-events" icon="fa-code" iconColor="blue-500">
    Write, place, and validate your first event snippet.
  </Card>
  <Card title="Install the Tracking Tag" href="/docs/install-anytrack-tag" icon="fa-rocket" iconColor="blue-500">
    Set up the base script every snippet depends on.
  </Card>
  <Card title="Event Attributes" href="/docs/event-attributes" icon="fa-list" iconColor="blue-500">
    See every attribute you can pass with an event.
  </Card>
  <Card title="Tracking Tag Helper" href="/docs/anytrack-chrome-extension" icon="fa-puzzle-piece" iconColor="blue-500">
    Verify your Tag and snippets with the Chrome extension.
  </Card>
</Cards>
