Skip to content

Advanced Event Tracking

Learn how to set up custom event triggers in AnyTrack to track advanced user interactions like element visibility, time on site, DOM clicks, and webhook-based conversions. Includes code snippets for each trigger type and instructions for disabling tracking on specific pages or elements.

Track advanced user interactions: element visibility, time on site, webhooks, and DOM clicks. Capture conversion signals that standard tracking misses. Advanced triggers give you precise control over when events fire, so you can measure the actions that matter most to your ROAS.

Track web events using the client-side snippet below. This is your foundation for all advanced tracking methods.

// trigger a lead event
var click_id = AnyTrack('trigger', 'Lead');

The snippet accepts standard Event Attributes to enrich events with customer data, product details, and context.

What gets tracked automatically:

  • Page URL, title, and path
  • First-party data (Google Analytics Client ID, Facebook cookies)
  • Session context and UTM parameters

What gets sent server-side: Events are automatically forwarded to all connected ad platforms via Conversion API, bypassing browser restrictions for complete data capture.

Example: An OutboundClick event structure:

{
"cid": "TZRImeinAR5B1V",
"ts": 1686737927708,
"pt": 1686737861561,
"en": "OutboundClick",
"dl": "https://readme.anytrack.io/docs/autotag",
"dt": "AutoTag",
"cp": [
{
"type": "ga",
"id": "UA-143868881-3",
"clientId": "1906187177.1686711792"
},
],
"id": "kv0bmJw0",
"tgid": "calendly",
"link": {
"id": "content-container",
"label": "Calendly Link.",
"url": "https://calendly.com/anytrack/"
}
}

Combine the basic snippet with the advanced tracking methods below to capture specific user behaviors.

Track when users scroll to specific elements — useful for measuring engagement with key content, pricing tables, or CTAs before they click.

AnyTrack("onViewport", "#my-button", function() {
AnyTrack("trigger", "ViewButton");
});

Use case: Measure how many visitors see your pricing before leaving, or track CTA visibility to understand drop-off points in your funnel.

Send conversion data to AnyTrack via webhook to connect external events (like CRM updates or payment confirmations) back to the original ad click. This enables offline conversion tracking for events that happen outside your website.

📘 Note

  • Create a Custom Conversions source in AnyTrack.
  • Copy the Postback URL and replace the URL in the snippet below.
<script>
AnyTrack('postback', 'https://t1.anytrack.io/:accountid/collect?click_id=--CLICK-ID--', {
eventName: 'Purchase',
brand: 'bar',
eventValue: 59.99,
currency: 'USD',
quantity: 1,
transactionId: '089asd8fa0s8f',
email: 'johndoe@example.com',
});
</script>

📘 Boost Event Match Quality

Enrich webhook events with customer data (email, phone) and product data (SKU, value, currency) to improve attribution accuracy and ad optimization. See the complete list of Event Attributes.

Measure visitor engagement by tracking time spent on your pages. Useful for identifying high-quality traffic sources and qualifying leads based on engagement depth.

setTimeout(function() {
AnyTrack('trigger', 'LongVisit');
}, 10e3);

The example above triggers a LongVisit event after 10 seconds. Adjust the timeout value to match your engagement threshold (e.g., 30 seconds for blog posts, 60 seconds for pricing pages).

Use case: Create custom audiences of engaged visitors who spent 30+ seconds on your pricing page, or track which traffic sources deliver visitors who actually consume your content.

Add click tracking to any HTML element — buttons, links, images, or custom components — to measure micro-conversions throughout your funnel.

<button onclick="AnyTrack('trigger', 'ClickViewDetails')">View Details</button>

Use case: Track clicks on “View Demo,” “See Pricing,” or “Read More” buttons to identify high-intent visitors and build retargeting audiences based on specific interactions.

Watch this video to learn how to track button clicks

Section titled “Watch this video to learn how to track button clicks”

Stop the Tracking Tag from loading on specific pages (like internal dashboards, admin pages, or thank-you pages you don’t want to retarget). Add this snippet to the <head> section of pages you want to exclude:

<script>
AnyTrack('quiet');
</script>

Use case: Prevent tracking on logged-in user dashboards, internal tools, or pages that would skew your analytics and retargeting audiences.

The AutoTrack function automatically captures OutboundClick and FormSubmit events across your website. In most cases this is exactly what you want — but sometimes you need to exclude specific links or forms (like navigation menus, footer links, or internal tools).

Add class="at-do-not-track" to any element to exclude it from automatic tracking. This works on individual elements or container divs (which excludes all links and forms inside).

<a href="https://clickfunnels.com" class="at-do-not-track">UNTRACKABLE LINK</a>

Use case: Exclude internal navigation, footer links, or frequently-clicked elements that would create noise in your conversion data without representing genuine user intent.


FAQ & Troubleshooting

FAQ was last reviewed on 2026-06-10

Do advanced triggers require the Tracking Tag to be installed?
Yes. All event snippets and trigger commands require the Tracking Tag to be loaded in the page head section first. Without the Tag, trigger commands will not execute.
Can I combine multiple trigger types on the same page?
Yes. You can use element visibility, time-on-site, DOM click, and webhook triggers together on the same page. Each trigger fires independently when its condition is met.
How do I verify that my custom trigger is working?
Use the Tracking Tag Helper Chrome extension to confirm the event fires. Then check the Conversion Report in your AnyTrack dashboard to verify the event data.