Built-in variables for AMP containers

Device and Browser

Browser Language: Provides a string that represents the preferred language of the user, usually the language of the browser UI (e.g. zh-tw.)

Client Timezone: Provides the user's time-zone offset from UTC, in minutes (e.g. 480 for Pacific Standard Time.)

Screen Height: Provides the screen height in pixels. The value is retrieved from window.screen.height (e.g. 1920.)

Screen Width: Provides the screen width in pixels. The value is retrieved from window.screen.width (e.g. 1080.)

Scroll Height: Provides the total height of the page in pixels (e.g. 2080.)

Scroll Left: Provides the number of pixels that the user has scrolled from left (e.g. 100.)

Scroll Top: Provides the number of pixels that the user has scrolled from top (e.g. 0.)

Scroll Width: Provides the total width of the page in pixels (e.g. 800.)

Interaction

Total Engaged Time: Provides the total time (in seconds) the user has been engaged with the page since the page first became visible in the viewport. Total engaged time will be 0 until the page first becomes visible (e.g. 36.)

Miscellaneous

AMP Event: Accesses the event that caused the trigger to fire. (e.g. gtm.pageview.)

Client Timestamp: Provides the number of seconds that have elapsed since 1970 (Epoch time) (e.g. 1452710304312.)

Page Client ID: Provides a user identifier. The client id will be the same for the same user if they visit again within one year.

Page View ID: Provides a string that is intended to be random and likely to be unique per URL, user and day (e.g. 978.)

Page and content

Canonical Host: Provides the canonical URL's host (e.g. example.com.)

Canonical Path: Provides the canonical URL's path part (e.g. /analytics.html.)

Canonical URL: Provides the canonical URL of the current document (e.g. http://example.com:8000/analytics.html​.)

Document Referrer: Provides the referrer where the user came from. It is read from document.referrer. The value is empty for direct visitors (e.g. https://www.google.com.)

Document Title: Provides the title of the current page.

Pages

Page Hostname: Provides the hostname portion of the current URL.

Page Path: Provides the path portion of the current URL.

Page URL: Provides the full URL of the current page.

Performance

Page Download Time: Provides the duration between the first and the last byte of response. The value is in milliseconds (e.g. 100.)

Page Load Time: Provides the time taken to load the whole page. The value is calculated from the time unload event handler on previous page ends to the time load event for the current page is fired. If there is no previous page, the duration starts from the time the user agent is ready to fetch the document using an HTTP request. The value is in milliseconds (e.g. 220.)

Utilities

Container ID: Provides the container's public ID. (e.g. GTM-XKCD42-9.)

Container Version: Provides the version number of the container, as a string.

Environment Name: Returns the user-provided name of the current environment, if the container request was made from an environment "Share Preview" link or from an environment snippet. For the built-in environments, it will return "Live", "Latest", or "Now Editing". In all other cases it returns an empty string.

Random Number: Generates a random integer between 0 and 2147483647.

Was this article helpful?
How can we improve it?