PageView and Click ID

Learn how AnyTrack tracks page views automatically and how to generate the atclid Click ID variable for use in forms, links, or CRM integrations. Covers the atclid command, callback syntax, Google Tag Manager setup, and the atclidToUrl method for appending the Click ID to page URLs.

PageView events track every page load, building a complete picture of the customer journey. The AnyTrack Tag automatically captures page views and enriches them with UTM parameters, traffic source, and session data. Ad platforms use this journey data to understand what content and messaging drives conversions.

❗️

Technical implementation required

The atclid and atclidToUrl commands below require JavaScript knowledge. If you are not comfortable with code, share this guide with your developer.

Generate the atclid Variable

The atclid command returns a Click ID generated from the current user session, without relating it to any specific event. Use this when you need the Click ID value for custom integrations:

var atclid = AnyTrack('atclid');

This command only works after the AnyTrack Tag has loaded. To ensure the Tag is ready, wrap the call in a callback:

AnyTrack(function () {
    var atclid = AnyTrack('atclid');
    // Use atclid value here
});

Generate atclid in Google Tag Manager

Create a Custom JavaScript Variable in GTM with the following code:

function () {
    return AnyTrack('atclid');
}

The atclid value is then available as a variable in any tag within your GTM container.

Append Click ID to Page URL

For form builders that cannot support hidden fields but can read URL parameters, use the atclidToUrl command to append the Click ID to the page URL:

<script>
  AnyTrack(function() {
    AnyTrack('atclidToUrl', 'custom_query_parameter');
  });
</script>

Replace custom_query_parameter with the parameter name your form expects. The default parameter name is _atid if no custom name is provided.

For a complete guide on URL-based Click ID passing, see Single Page Tracking.


Frequently Asked Questions

FAQ was last reviewed on 2026-02-18

No. The AnyTrack Tag tracks page views automatically once installed. The commands on this page are only needed when you want to access the Click ID value programmatically for custom integrations.
The atclid command generates a Click ID from the current session without tying it to a specific event. The trigger command generates a Click ID that is associated with a specific event like Lead or Purchase. Both return valid Click IDs that can be used for server-side tracking.
Use atclidToUrl when your form builder does not support hidden field injection but can capture values from URL parameters. See Single Page Tracking for the full setup guide.