AMP

Important: this documentation is not applicable to your currently selected format email!

amp-pixel

Description

A tracking pixel to count page views.

 

Supported Layouts

Description Can be used as a typical tracking pixel to count pageviews.
Supported Layouts fixed, nodisplay
Examples See AMP By Example's amp-pixel example.

Usage

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 substitutions section for further details.

In this basic example, the amp-pixel issues a simple GET request to the given URL and ignores the result.

<amp-pixel src="https://foo.com/tracker/foo" layout="nodisplay"></amp-pixel>

When processing AMP URLs in the referrer header of analytics requests, strip out or ignore the usqp parameter. This parameter is used by Google to trigger experiments for the Google AMP Cache.

Substitutions

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

In the following example, a request might be made to something like https://foo.com/pixel?0.8390278471201 where the RANDOM value is randomly generated upon each impression.

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

Attributes

src (required)

A simple URL to a remote endpoint that must be https protocol.

referrerpolicy (optional)

This attribute is similar to the referrerpolicy attribute on <img>, however no-referrer is the only accepted value. If referrerpolicy=no-referrer is specified, the referrer header is removed from the HTTP request.

<amp-pixel
  src="https://foo.com/tracker/foo"
  layout="nodisplay"
  referrerpolicy="no-referrer"
></amp-pixel>

allow-ssr-img (optional)

This attribute used in AMP4ADS creatives indicates that as part of post validation transformation, an img element may be placed directly within the amp-pixel element allowing the ping to be sent in parallel with AMP runtime fetch/execution. Note that it means that any macros within the url will NOT be expanded so only use if they are not present in the src.

Common attributes

This element includes common attributes extended to AMP components.

Styling

amp-pixel should not be styled.

Validation

See amp-pixel rules in the AMP validator specification.

Требуется дополнительная помощь?

Вы читали этот документ десятки раз, но так и не нашли ответов на все свои вопросы? Возможно, другие люди столкнулись с такой же проблемой — обратитесь к ним на Stack Overflow.

Перейти на Stack Overflow
Нашли ошибку или недостающую функцию?

Проект AMP активно поощряет ваше участие и сотрудничество! Мы надеемся, что вы станете постоянным участником нашего открытого сообщества, но разовые вклады в работу над задачами, которые вам особенно интересны, также приветствуются.

Перейти на GitHub