Clear search
Close search
Google apps
Main menu

Built-in variables for AMP containers

Device and Browser

Browser Language: Provides a string representing the preferred language of the user, usually the language of the browser UI. Example value: zh-tw

Client Timezone: Provides the user's time-zone offset from UTC, in minutes. Example value: 480 for Pacific Standard Time.

Screen Height: Provides the screen height in pixels. The value is retrieved from window.screen.height. Example value: 1920

Screen Width: Provides the screen width in pixels. The value is retrieved from window.screen.width. Example value: 1080

Scroll Height: Provides the total height of the page in pixels. Example value: 2080

Scroll Left: Provides the number of pixels that the user has scrolled from left. Example value: 100

Scroll Top: Provides the number of pixels that the user has scrolled from top. Example value: 0

Scroll Width: Provides the total width of the page in pixels. Example value: 800


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. Example value: 36


AMP Event: Accesses the "event" that caused the trigger to fire. Example value: gtm.pageview

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

Page Client ID: Provides a per document-source-origin (the origin of the website where you publish your AMP doc) and 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. Example value: 978

Page and content

Canonical Host: Provides the canonical URL's host. Example value:

Canonical Path: Provides the canonical URL's path part. Example value: /analytics.html

Canonical URL: Provides the canonical URL of the current document. Example value:​

Document Referrer: Provides the referrer where the user came from. It is read from document.referrer. The value is empty for direct visitors. Example value:

Document Title: Provides the title of the current document. Example value: The New York Times - Breaking News, World News...


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.


Page Download Time: Provides the time between receiving the first and the last byte of response. The value is in milliseconds. Example value: 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. Example value: 220


Container ID: Provides the container's public ID. Example value: GTM-XKCD11

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 including non-environment container requests, it returns an empty string.

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

Was this article helpful?
How can we improve it?