Some components such as amp-pixel
,
amp-list
and amp-analytics
allow variables to be substituted in the relevant URLs. AMP provides a number of standard variable substitutions and allows each component to add their own. The rest of this document talks about the variables supported by the platform.
Anchor href's that are the target (or have a child who is the target) of a click are synchronously expanded. Variables below that are asynchronous by nature are replaced with empty string to ensure page navigation is not delayed. If the navigation is prevented, the href is still updated however later clicks will still update to the most current values of the variables. Note that some variables will not allow for expansion for A4A creatives. Specifics will be addressed at a later time.
The tables below list the available URL variables grouped by type of usage. Further down in this document, are descriptions of each of the variables, along with example usages.
Variable Name | Platform Variable | amp-analytics Variable |
---|---|---|
AMP Document Host | AMPDOC_HOST |
${ampdocHost} |
AMP Document Hostname | AMPDOC_HOSTNAME |
${ampdocHostname} |
AMP Document URL | AMPDOC_URL |
${ampdocUrl} |
Canonical Host | CANONICAL_HOST |
${canonicalHost} |
Canonical Hostname | CANONICAL_HOSTNAME |
${canonicalHostname} |
Canonical Path | CANONICAL_PATH |
${canonicalPath} |
Canonical URL | CANONICAL_URL |
${canonicalUrl} |
Counter | COUNTER |
${counter} |
Document Charset | DOCUMENT_CHARSET |
${documentCharset} |
Document Referrer | DOCUMENT_REFERRER |
${documentReferrer} |
Source URL | SOURCE_URL |
${sourceUrl} |
Source Host | SOURCE_HOST |
${sourceHost} |
Source Hostname | SOURCE_HOSTNAME |
${sourceHostname} |
Source Path | SOURCE_PATH |
${sourcePath} |
Title | TITLE |
${title} |
Viewer | VIEWER |
${viewer} |
Variable Name | Platform Variable | amp-analytics Variable |
---|---|---|
Content Load Time | CONTENT_LOAD_TIME |
${contentLoadTime} |
Domain Lookup Time | DOMAIN_LOOKUP_TIME |
${domainLookupTime} |
DOM Interactive Time | DOM_INTERACTIVE_TIME |
${domInteractiveTime} |
Navigation Redirect Count | NAV_REDIRECT_COUNT |
${navRedirectCount} |
Navigation Timing | NAV_TIMING |
${navTiming} |
Navigation Type | NAV_TYPE |
${navType} |
Page Download Time | PAGE_DOWNLOAD_TIME |
${pageDownloadTime} |
Page Load Time | PAGE_LOAD_TIME |
${pageLoadTime} |
Redirect Time | REDIRECT_TIME |
${redirectTime} |
Server Response Time | SERVER_RESPONSE_TIME |
${serverResponseTime} |
TCP Connection Time | TCP_CONNECT_TIME |
${tcpConnectTime} |
Variable Name | Platform Variable | amp-analytics Variable |
---|---|---|
Available Screen Height | AVAILABLE_SCREEN_HEIGHT |
${availableScreenHeight} |
Available Screen Width | AVAILABLE_SCREEN_WIDTH |
${availableScreenWidth} |
Browser Language | BROWSER_LANGUAGE |
${browserLanguage} |
Screen Color Depth | SCREEN_COLOR_DEPTH |
${screenColorDepth} |
Screen Height | SCREEN_HEIGHT |
${screenHeight} |
Screen Width | SCREEN_WIDTH |
${screenWidth} |
Scroll Height | SCROLL_HEIGHT |
${scrollHeight} |
Scroll Width | SCROLL_WIDTH |
${scrollWidth} |
Scroll Left | SCROLL_LEFT |
${scrollLeft} |
Scroll Top | SCROLL_TOP |
${scrollTop} |
Timezone | TIMEZONE |
${timezone} |
Viewport Height | VIEWPORT_HEIGHT |
${viewportHeight} |
Viewport Width | VIEWPORT_WIDTH |
${viewportWidth} |
Variable Name | Platform Variable | amp-analytics Variable |
---|---|---|
Horizontal Scroll Boundary | N/A | ${horizontalScrollBoundary} |
Total Engaged Time | TOTAL_ENGAGED_TIME |
${totalEngagedTime} |
Vertical Scroll Boundary | N/A | ${verticalScrollBoundary} |
Variable Name | Platform Variable | amp-analytics Variable |
---|---|---|
Backgrounded | N/A | ${backgrounded} |
Backgrounded At Start | N/A | ${backgroundedAtStart} |
Carousel From Slide | N/A | ${fromSlide} |
Carousel To Slide | N/A | ${toSlide} |
Element Height | N/A | ${elementHeight} |
Element Width | N/A | ${elementWidth} |
Element X | N/A | ${elementX} |
Element Y | N/A | ${elementY} |
First Seen Time | N/A | ${firstSeenTime} |
First Visible Time | N/A | ${firstVisibleTime} |
Last Seen Time | N/A | ${lastSeenTime} |
Last Visible Time | N/A | ${lastVisibleTime} |
Load Time Visibility | N/A | ${loadTimeVisibility} |
Max Continuous Visible Time | N/A | ${maxContinuousVisibleTime} |
Max Visible Percentage | N/A | ${maxVisiblePercentage} |
Min Visible Percentage | N/A | ${minVisiblePercentage} |
Total Time | N/A | ${totalTime} |
Total Visible Time | N/A | ${totalVisibleTime} |
Variable Name | Platform Variable | amp-analytics Variable |
---|---|---|
AMP Version | AMP_VERSION |
${ampVersion} |
Background State | BACKGROUND_STATE |
${backgroundState} |
Client ID | CLIENT_ID |
${clientId} |
Extra URL Parameters | N/A | ${extraUrlParams} |
Page View ID | PAGE_VIEW_ID |
${pageViewId} |
Query Parameter | QUERY_PARAM |
${queryParam} |
Random | RANDOM |
${random} |
Request Count | N/A | ${requestCount} |
Timestamp | TIMESTAMP |
${timestamp} |
Provides the AMP document's URL host.
- platform variable:
AMPDOC_HOST
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?host=AMPDOC_HOST"></amp-pixel>
https://foo.com/pixel?host=example.com:8080
. - Example:
- amp-analytics variable:
${ampdocHost}
- Example value:
example.com
- Example value:
Provides the AMP document's URL hostname.
- platform variable:
AMPDOC_HOSTNAME
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?hostname=AMPDOC_HOSTNAME"></amp-pixel>
https://foo.com/pixel?hostname=example.com
. - Example:
- amp-analytics variable:
${ampdocHostname}
- Example value:
example.com
- Example value:
Provides the AMP document's URL. The URL contains the scheme, domain, port and full path. It does not contain the fragment part of the URL.
- platform variable:
AMPDOC_URL
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?ref=AMPDOC_URL"></amp-pixel>
https://foo.com/pixel?ref=https%3A%2F%2Fexample.com%2F
. - Example:
- amp-analytics variable:
${ampdocUrl}
- Example value:
http://example.com:8000/examples/analytics.amp.html
- Example value:
Provides a string with the AMP release version.
- platform variable:
AMP_VERSION
- Example:
<amp-pixel src="https://foo.com/pixel?v=AMP_VERSION"></amp-pixel>
- Example:
- amp-analytics variable:
${ampVersion}
- Example value:
1460655576651
- Example value:
Provides the screen height in pixels available for the page rendering. This value can be slightly more or less than the actual viewport size because of various browser quirks.
- platform variable:
AVAILABLE_SCREEN_HEIGHT
- Example:
<amp-pixel src="https://foo.com/pixel?availScreenHeight=AVAILABLE_SCREEN_HEIGHT"></amp-pixel>
- Example:
- amp-analytics variable:
${availableScreenHeight}
- Example value:
1480
- Example value:
Provides the screen width in pixels available for the page rendering. This value can be slightly more or less than the actual viewport height due to various browser quirks.
- platform variable:
AVAILABLE_SCREEN_WIDTH
- Example:
<amp-pixel src="https://foo.com/pixel?availScreenWidth=AVAILABLE_SCREEN_WIDTH"></amp-pixel>
- Example:
- amp-analytics variable:
${availableScreenWidth}
- Example value:
2500
- Example value:
A binary variable with possible values of 1 and 0 to indicate that the page/tab was sent to background at any point before the hit was sent. 1 indicates that the page was backgrounded while 0 indicates that the page has always been in the foreground. This variable does not count prerender as a backgrounded state.
- platform variable: N/A
- amp-analytics variable:
${backgrounded}
A binary variable with possible values of 1 and 0 to indicate that the page/tab was backgrounded at the time when the page was loaded. 1 indicates that the page was loaded in the background while 0 indicates otherwise. This variable does not count prerender as a backgrounded state.
- platform variable: N/A
- amp-analytics variable:
${backgroundedAtStart}
Provides the current background state of the page. Possible values are 0
, the page is visible, or 1
, the page is backgrounded.
- platform variable:
BACKGROUND_STATE
- amp-analytics variable:
${backgroundState}
Provides a string representing the preferred language of the user, usually the language of the browser UI.
- platform variable:
BROWSER_LANGUAGE
- Example:
<amp-pixel src="https://foo.com/pixel?lang=BROWSER_LANGUAGE"></amp-pixel>
- Example:
- amp-analytics variable:
${browserLanguage}
- Example value:
en-us
- Example value:
Provides the canonical document's URL host.
- platform variable:
CANONICAL_HOST
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?host=CANONICAL_HOST"></amp-pixel>
https://foo.com/pixel?host=pinterest.com:9000
. - Example:
- amp-analytics variable:
${canonicalHost}
- Example value:
http://pinterest.com:9000
- Example value:
Provides the canonical document's URL hostname.
- platform variable:
CANONICAL_HOSTNAME
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?hostname=CANONICAL_HOSTNAME"></amp-pixel>
https://foo.com/pixel?host=pinterest.com
. - Example:
- amp-analytics variable:
${canonicalHostname}
- Example value:
pinterest.com
- Example value:
Provides the canonical document's URL path.
- platform variable:
CANONICAL_PATH
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?path=CANONICAL_PATH"></amp-pixel>
https://foo.com/pixel?path=%2Fpage1.html
. - Example:
- amp-analytics variable:
${canonicalPath}
- Example value:
%2Fanalytics.html
- Example value:
Provides the canonical document's URL.
- platform variable:
CANONICAL_URL
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?href=CANONICAL_URL"></amp-pixel>
https://foo.com/pixel?href=https%3A%2F%2Fpinterest.com%2F
. - Example:
- amp-analytics variable:
${canonicalUrl}
- Example value:
http%3A%2F%2Fexample.com%3A8000%2Fanalytics.html
- Example value:
Provides the amp-carousel
slide from which the traversal happens. The value is either taken from the data-slide-id
attribute of the slide when present, else it represents the index of the slide (starting from 0).
- platform variable: N/A
- amp-analytics variable:
${fromSlide}
For more information on analytics for amp-carousel
, see AMP Carousel and Analytics.
Provides the amp-carousel
slide to which the traversal happens. The value is either taken from the data-slide-id
attribute of the slide when present, else it represents the index of the slide (starting from 0).
- platform variable: N/A
- amp-analytics variable:
${toSlide}
For more information on analytics for amp-carousel
, see AMP Carousel and Analytics.
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. The client ID should behave roughly similar to a cookie storing a session ID for one year. If the AMP document is not served through the Google AMP Cache, the client ID is replaced with a cookie of the name of the cid scope
argument (see below). If it is not present, a cookie will be set with the same name. These cookies will always have the prefix "amp-" followed by a random base64 encoded string.
- platform variable:
CLIENT_ID
- Example:
<amp-pixel src="https://foo.com/pixel?cid=CLIENT_ID(cid-scope-cookie-fallback-name)"></amp-pixel>
- Example:
This site uses cookies to personalize content. Learn more. I accept
* **amp-analytics variable**: `${clientId}`
* Example usage: `${clientId(foo)}`
* Example value: `U6XEpUs3yaeQyR2DKATQH1pTZ6kg140fvuLbtl5nynbUWtIodJxP5TEIYBic4qcV`
##### Client ID arguments
You can pass the following arguments into the Client ID variable like a function. Spaces between arguments and values are not allowed.
- `cid scope` (Required): The name of the fallback cookie when the document
is not served by an AMP proxy.
- `amp-user-notification id` (Optional): Use this argument to make the Client ID substitution dependent on the dismissal of a user notification shown to the visitor of the page. In amp-analytics, this is the same as using the [`data-consent-notification-id`](../extensions/amp-analytics/amp-analytics.md) attribute -- you may choose to use either one for the amp-analytics component.
#### Content Load Time
Provides the time the page takes to fire the `DOMContentLoaded` event from the time the previous page is unloaded. The value is in milliseconds.
* **platform variable**: `CONTENT_LOAD_TIME`
* Example: <br>
```html
<amp-pixel src="https://foo.com/pixel?contentLoadTime=CONTENT_LOAD_TIME"></amp-pixel>
- amp-analytics variable:
${contentLoadTime}
- Example value:
40
- Example value:
Use COUNTER(name)
to generate an index for the given request. Counts start at 1 and are per given name
.
- platform variable:
COUNTER
- amp-analytics variable:
${counter}
Provides the character encoding of the current document.
- platform variable:
DOCUMENT_CHARSET
- Example:
<amp-pixel src="https://foo.com/pixel?charSet=DOCUMENT_CHARSET"></amp-pixel>
- Example:
- amp-analytics variable:
${documentCharset}
- Example value:
UTF-8
- Example value:
Provides the referrer where the user came from, which is read from document.referrer
. The value is empty for direct visitors.
- platform variable:
DOCUMENT_REFERRER
- Example:
<amp-pixel src="https://foo.com/pixel?referrer=DOCUMENT_REFERRER"></amp-pixel>
- Example:
- amp-analytics variable:
${documentReferrer}
- Example value:
https://www.google.com
- Example value:
Provides the time it took to perform the DNS lookup for the current page. The value is in milliseconds.
- platform variable:
DOMAIN_LOOKUP_TIME
- Example:
<amp-pixel src="https://foo.com/pixel?domainLookupTime=DOMAIN_LOOKUP_TIME"></amp-pixel>
- Example:
- amp-analytics variable:
${domainLookupTime}
- Example value:
1
- Example value:
Provides the time the page to become interactive from the time the previous page is unloaded. The value is in milliseconds.
- platform variable:
DOM_INTERACTIVE_TIME
- Example:
<amp-pixel src="https://foo.com/pixel?domInteractiveTime=DOM_INTERACTIVE_TIME"></amp-pixel>
- Example:
- amp-analytics variable:
${domInteractiveTime}
- Example value:
40
- Example value:
Provides the height of the element specified by visibilitySpec
.
- platform variable: N/A
- amp-analytics variable:
${elementHeight}
Provides the width of the element specified by visibilitySpec
.
- platform variable: N/A
- amp-analytics variable:
${elementWidth}
Provides the absolute X coordinate of the left edge of the element specified by visibilitySpec
.
- platform variable: N/A
- amp-analytics variable:
${elementX}
Provides the absolute Y coordinate of the top edge of the element specified by visibilitySpec
.
- platform variable: N/A
- amp-analytics variable:
${elementY}
Provides all the parameters that are defined in the extraUrlParams
block of the amp-analytics config as a variable. If you use the extraUrlParams
variable, the parameters are not appended to the end of the URL.
- platform variable: N/A
- amp-analytics variable:
${extraUrlParams}
- Example value:
foo=bar&baz=something
- Example value:
Provides the time when at least 1px of the element is on the screen for the first time since the trigger is registered by amp-analytics
.
- platform variable: N/A
- amp-analytics variable:
${firstSeenTime}
Provides the time when the element met visibility conditions for the first time since the trigger is registered by amp-analytics
.
- platform variable: N/A
- amp-analytics variable:
${firstVisibleTime}
Provides the horizontal scroll boundary that triggered a scroll event. This variable is only available in a trigger
of type scroll
. The value of the boundary may be rounded based on the precision supported by the extension. For example, a boundary with value 1
and precision of 5
will result in value of var to be 0.
- platform variable: N/A
- amp-analytics variable:
${horizontalScrollBoundary}
Provides the time when at least 1px of the element is on the screen for the last time since javascript load.
- platform variable: N/A
- amp-analytics variable:
${lastSeenTime}
Provides the time when the element met visibility conditions for the last time since javascript load.
- platform variable: N/A
- amp-analytics variable:
${lastVisibleTime}
Provides the percentage of element visible in the viewport at load time. This variable assumes that the page is scrolled to top.
- platform variable: N/A
- amp-analytics variable:
${loadTimeVisibility}
Provides the maximum amount of continuous time an element has met the visibilitySpec
conditions at the time this ping is sent. Note that a ping with a continuousTimeMin=1000
and totalTimeMin=5000
that is visible for 1000ms, then not visible, then visible for 2000ms, then not, then visible for 1000ms, then not, then visible for 1020ms will report 2000 for this number as that is the max continuous visible time, even if it is not the current continuous visible time (1020 in this example).
- platform variable: N/A
- amp-analytics variable:
${maxContinuousVisibleTime}
Provides the maximum visible percentage over the time that visibilitySpec
conditions were met. For example, a ping where the element was 100%, then off the page, then 100% will report this value as 100. A ping with visiblePercentageMax=50
undergoing the same transitions would report somewhere between 0 and 50 since any time when the element was 100% on the page would not be counted.
- platform variable: N/A
- amp-analytics variable:
${maxVisiblePercentage}
Provides the minimum visible percentage over the time that visibilitySpec
conditions were met. For example, a ping where the element was 100%, then off the page, then 100% will report this value as 0. A ping with visiblePercentageMin=50
condition undergoing the same transitions would report somewhere between 50 and 100 since any time when the element was 0% to 50% on the page would not be counted.
- platform variable: N/A
- amp-analytics variable:
${minVisiblePercentage}
Provides the number of redirects since the last non-redirect navigation. For more information, see the W3C Navigation Timing API PerformanceNavigation interface.
- platform variable:
NAV_REDIRECT_COUNT
- Example:
<amp-pixel src="https://foo.com/pixel?nrc=NAV_REDIRECT_COUNT"></amp-pixel>
- Example:
- amp-analytics variable:
${navRedirectCount}
- Example value:
0
- Example value:
Provides access to metrics from the browser's PerformanceTiming interface. See the W3C Navigation Timing API PerformanceTiming interface documentation for attribute names and definitions.
- platform variable:
NAV_TIMING
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?navStart=NAV_TIMING(navigationStart)&pageLoadTime=NAV_TIMING(navigationStart,loadEventStart)"></amp-pixel>
https://foo.com/pixel?navStart=1451606400000&pageLoadTime=100
. - Example:
- amp-analytics variable:
${navTiming}
- Example 1:
${navTiming(navigationStart)}
results in value:1451606400000
- Example 2:
${navTiming(navigationStart,responseStart)}
results in value:10
- Example 1:
You can pass the following arguments into the Navigation Timing variable like a function. Spaces between arguments and values are not allowed.
startEvent
(Required): The name of the PerformanceTiming interface attribute that corresponds to the start event.endEvent
(Optional): The name of the PerformanceTiming interface attribute that corresponds to the end event. IfendEvent
is passed, the value will be the time difference between the start and end events.
If both startEvent
and endEvent
arguments are passed, the value will be the time elapsed between the two events. Otherwise, if only startEvent
argument is passed, the value will be the timestamp of the given event.
The value is in milliseconds.
Provides the type of the last non-redirect navigation in the current browsing context. See the W3C Navigation Timing API PerformanceNavigation interface for more information.
- platform variable:
NAV_TYPE
- Example:
<amp-pixel src="https://foo.com/pixel?nt=NAV_TYPE"></amp-pixel>
- Example:
- amp-analytics variable:
${navType}
- Example value:
1
- Example value:
Provides the time between receiving the first and the last byte of response. The value is in milliseconds.
- platform variable:
PAGE_DOWNLOAD_TIME
- Example:
<amp-pixel src="https://foo.com/pixel?pageDownloadTime=PAGE_DOWNLOAD_TIME"></amp-pixel>
- Example:
- amp-analytics variable:
${pageDownloadTime}
- Example value:
100
- Example value:
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.
- platform variable:
PAGE_LOAD_TIME
- Example:
<amp-pixel src="https://foo.com/pixel?pageLoadTime=PAGE_LOAD_TIME"></amp-pixel>
- Example:
- amp-analytics variable:
${pageLoadTime}
- Example value:
220
- Example value:
Provides a string that is intended to be random and likely to be unique per URL, user and day.
- platform variable:
PAGE_VIEW_ID
- Example:
<amp-pixel src="https://foo.com/pixel?pid=PAGE_VIEW_ID"></amp-pixel>
- Example:
- amp-analytics variable:
${pageViewId}
- Example value:
978
- Example value:
Pulls a value from the provided query string parameter.
- platform variable:
QUERY_PARAM
- Example:
If a<amp-pixel src="https://foo.com/pixel?bar=QUERY_PARAM(baz,biz)"</amp-pixel>
baz
query string parameter is provided, the corresponding value is inserted into the pixel src; otherwise, the defaultbiz
is used. - Example:
- amp-analytics variable:
${queryParam}
- Example 1:
${queryParam(foo)}
: Iffoo
is available, its associated value is returned; otherwise, an empty string is returned. - Example 2:
${queryParam(foo,bar)}
: iffoo
is available, its associated value is returned, otherwisebar
is returned.
- Example 1:
You can pass the following arguments into the Query Parameter variable like a function. Spaces between arguments and values are not allowed.
param
(Required): The key for the query string parameter to be inserted.defaultValue
(Optional): The value to use if the provided key is not present on the query string. Defaults to an empty value ("").
Provides a random value each time a request is constructed.
- platform variable:
RANDOM
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?RANDOM"></amp-pixel>
https://foo.com/pixel?0.8390278471201
where the $RANDOM value is randomly generated upon each impression. - Example:
- amp-analytics variable:
${random}
- Example value:
0.12345632345
- Example value:
Provides the time taken to complete all the redirects before the request for the current page is made. The value is in milliseconds.
- platform variable:
REDIRECT_TIME
- Example:
<amp-pixel src="https://foo.com/pixel?redirectTime=REDIRECT_TIME"></amp-pixel>
- Example:
- amp-analytics variable:
${redirectTime}
- Example value:
0
- Example value:
Provides the number of requests sent out from a particular amp-analytics
tag. This value can be used to reconstruct the sequence in which requests were sent from a tag. The value starts from 1 and increases monotonically. Note that there may be a gap in requestCount
numbers if the request sending fails due to network issues.
- platform variable: N/A
- amp-analytics variable:
${requestCount}
- Example value:
6
- Example value:
Provides the screen color depth provided by the browser.
- platform variable:
SCREEN_COLOR_DEPTH
- Example:
<amp-pixel src="https://foo.com/pixel?colorDepth=SCREEN_COLOR_DEPTH"></amp-pixel>
- Example:
- amp-analytics variable:
${screenColorDepth}
- Example value:
24
- Example value:
Provides the screen height in pixels. The value is retrieved from window.screen.height
.
- platform variable:
SCREEN_HEIGHT
- Example:
<amp-pixel src="https://foo.com/pixel?sh=SCREEN_HEIGHT"></amp-pixel>
- Example:
- amp-analytics variable:
${screenHeight}
- Example value:
1600
- Example value:
Provides the screen height in pixels. The value is retrieved from window.screen.width
.
- platform variable:
SCREEN_WIDTH
- Example:
<amp-pixel src="https://foo.com/pixel?sw=SCREEN_WIDTH"></amp-pixel>
- Example:
- amp-analytics variable:
${screenWidth}
- Example value:
2560
- Example value:
Provides the total height of the page in pixels.
- platform variable:
SCROLL_HEIGHT
- Example:
<amp-pixel src="https://foo.com/pixel?scrollHeight=SCROLL_HEIGHT"></amp-pixel>
- Example:
- amp-analytics variable:
${scrollHeight}
- Example value:
400
- Example value:
Provides the number of pixels that the user has scrolled from left.
- platform variable:
SCROLL_LEFT
- Example:
<amp-pixel src="https://foo.com/pixel?scrollLeft=SCROLL_LEFT"></amp-pixel>
- Example:
- amp-analytics variable:
${scrollLeft}
- Example value:
100
- Example value:
Provides the number of pixels that the user has scrolled from top.
- platform variable:
SCROLL_TOP
- Example:
<amp-pixel src="https://foo.com/pixel?st=SCROLL_TOP"></amp-pixel>
- Example:
- amp-analytics variable:
${scrollTop}
- Example value:
0
- Example value:
Provides the total width of the page in pixels.
- platform variable:
SCROLL_WIDTH
- Example:
<amp-pixel src="https://foo.com/pixel?scrollWidth=SCROLL_WIDTH"></amp-pixel>
- Example:
- amp-analytics variable:
${scrollWidth}
- Example value:
600
- Example value:
Provides the time taken by the server to start sending the response after it starts receiving the request. The value is in milliseconds.
- platform variable:
SERVER_RESPONSE_TIME
- Example:
<amp-pixel src="https://foo.com/pixel?serverResponseTime=SERVER_RESPONSE_TIME"></amp-pixel>
- Example:
- amp-analytics variable:
${serverResponseTime}
- Example value:
10
- Example value:
Parses and provides the source URL of the current document to the URL.
The source URL is extracted from the proxy URL if the document is being served from a known proxy. Otherwise, the original document URL is returned. For example, if the URL is served via the proxy https://cdn.ampproject.org
from the URL https://cdn.ampproject.org/c/s/example.com/page.html
, then SOURCE_URL
would return https://example.com/page.html
.
- platform variable:
SOURCE_URL
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?href=SOURCE_URL"></amp-pixel>
https://foo.com/pixel?href=https%3A%2F%2Fpinterest.com%2F
. - Example:
- amp-analytics variable:
${sourceUrl}
- Example value:
https%3A%2F%2Fpinterest.com%2F
- Example value:
Parses and provides the source URL's host. See the description of Source URL for more details.
- platform variable:
SOURCE_HOST
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?host=SOURCE_HOST"></amp-pixel>
https://foo.com/pixel?host=pinterest.com:9000
. - Example:
- amp-analytics variable:
${sourceHost}
- Example value:
example.com
- Example value:
Parses and provides the source URL's hostname. See the description of Source URL for more details.
- platform variable:
SOURCE_HOSTNAME
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?host=SOURCE_HOSTNAME"></amp-pixel>
https://foo.com/pixel?host=pinterest.com
. - Example:
- amp-analytics variable:
${sourceHostname}
- Example value:
example.com
- Example value:
Parses and provides the source URL's path. See the description of Source URL for more details.
- platform variable:
SOURCE_PATH
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?path=SOURCE_PATH"></amp-pixel>
https://foo.com/pixel?path=%2Fpage2.html
. - Example:
- amp-analytics variable:
${sourcePath}
- Example value:
%2Fpage2.html
- Example value:
Provides the time it took for HTTP connection to be setup. The duration includes connection handshake time and SOCKS authentication. The value is in milliseconds.
- platform variable:
TCP_CONNECT_TIME
- Example:
<amp-pixel src="https://foo.com/pixel?tcpConnectTime=TCP_CONNECT_TIME"></amp-pixel>
- Example:
- amp-analytics variable:
${tcpConnectTime}
- Example value:
10
- Example value:
Provides the title of the current document.
- platform variable:
TITLE
- Example:
Makes a request to something like<amp-pixel src="https://foo.com/pixel?title=TITLE"></amp-pixel>
https://foo.com/pixel?title=Breaking%20News
. - Example:
- amp-analytics variable:
${title}
- Example value:
The New York Times - Breaking News, World News...
- Example value:
Provides the number of seconds that have elapsed since 1970. (Epoch time)
- platform variable:
TIMESTAMP
- Example:
<amp-pixel src="https://foo.com/pixel?timestamp=TIMESTAMP"></amp-pixel>
- Example:
- amp-analytics variable:
${timestamp}
- Example value:
10
- Example value:
Provides the user's time-zone offset from UTC, in minutes.
- platform variable:
TIMEZONE
- Example:
<amp-pixel src="https://foo.com/pixel?tz=TIMEZONE"></amp-pixel>
- Example:
- amp-analytics variable:
${timezone}
- Example value:
480
for Pacific Standard Time.
- Example value:
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. This variable requires the amp-analytics extension to be present on the page.
- platform variable:
TOTAL_ENGAGED_TIME
- amp-analytics variable:
${totalEngagedTime}
- Example value:
36
- Example value:
Provides the total time from the time page was loaded to the time a ping was sent out. The value is calculated from the time document became interactive.
- platform variable: N/A
- amp-analytics variable:
${totalTime}
Provides the total time for which the element has met the visiblitySpec
conditions at time this ping is sent.
- platform variable: N/A
- amp-analytics variable:
${totalVisibleTime}
Provides the vertical scroll boundary that triggered a scroll event. This variable is only available in a trigger
of type scroll
. The value of the boundary may be rounded based on the precision supported by the extension. For example, a boundary with value 1
and precision of 5
will result in value of var to be 0.
- platform variable: N/A
- amp-analytics variable:
${verticalScrollBoundary}
Provides an identifier for the viewer that contains the AMP document. An empty string is provided when the document is loaded directly in the browser or if the id is not found.
- platform variable:
VIEWER
- Example:
<amp-pixel src="https://foo.com/pixel?viewer=VIEWER"></amp-pixel>
- Example:
- amp-analytics variable:
${viewer}
- Example value:
www.google.com
- Example value:
Provides the viewport height in pixels available for the page rendering. In contrast to AVAILABLE_SCREEN_HEIGHT
, this value takes window size and zooming into account.
- platform variable:
VIEWPORT_HEIGHT
- Example:
<amp-pixel src="https://foo.com/pixel?viewportHeight=VIEWPORT_HEIGHT"></amp-pixel>
- Example:
- amp-analytics variable:
${viewportHeight}
- Example value:
1600
- Example value:
Provides the viewport width in pixels available for the page rendering. In contrast to AVAILABLE_SCREEN_WIDTH
, this value takes window size and zooming into account.
- platform variable:
VIEWPORT_WIDTH
- Example:
<amp-pixel src="https://foo.com/pixel?viewportHeight=VIEWPORT_HEIGHT"></amp-pixel>
- Example:
- amp-analytics variable:
${viewportWidth}
- Example value:
2560
- Example value: