Skip to content

Latest commit

 

History

History
93 lines (75 loc) · 4.21 KB

amp-pixel.md

File metadata and controls

93 lines (75 loc) · 4.21 KB

amp-pixel

Description The amp-pixel element is meant to be used as a typical tracking pixel - to count page views.
Availability Stable
Examples everything.amp.html

Behavior

The amp-pixel component behaves like a simple tracking pixel img. It takes a single URL, but provides variables that can be replaced by the component in the URL string when making the request. See the src attribute for more information.

Attributes

src

A simple URL to send a GET request to when the tracking pixel is loaded.

Substitutions

The amp-pixel allows all standard URL variable substitutions. See Substitutions Guide for more info.

For instance:

<amp-pixel src="https://foo.com/pixel?RANDOM"></amp-pixel>

may make a request to something like https://foo.com/pixel?0.8390278471201 where the RANDOM value is randomly generated upon each impression.

Styling

amp-pixel should not be styled.

Validation errors

The following lists validation errors specific to the amp-pixel tag (see also amp-pixel in the AMP validator specification):

Validation Error Description
The mandatory attribute 'example1' is missing in tag 'example2'. Error thrown when src attribute is missing.
Missing URL for attribute 'example1' in tag 'example2'. Error thrown when src attribute is missing its URL.
Malformed URL 'example3' for attribute 'example1' in tag 'example2'. Error thrown when src attribute's URL is invalid.
Invalid URL protocol 'example3:' for attribute 'example1' in tag 'example2'. Error thrown src attribute's URL is http; https protocol required.
The implied layout 'example1' is not supported by tag 'example2'. Error thrown when implied layout set to FIXED_HEIGHT, RESPONSIVE, FILL, or CONTAINER as these aren't supported.
The specified layout 'example1' is not supported by tag 'example2'. Error thrown when specified layout set to FIXED_HEIGHT, RESPONSIVE, FILL, or CONTAINER as these aren't supported.