Skip to content

Google AMP sensor

You want to collect the full potential of your data via INFOnline Measurement?

We recommend that you additionally integrate the pseudonymous measurement into your Google AMP article. Please note that participation of your site in IVW reporting may require parallel integration of pseudonymous measurement and census measurement in your Google AMP article.

Census measurement

Attention

If you activate pseudonymous measurement via the INFOnline Measurement Manager, it is mandatory to have the standalone script integrated in Google AMP article.

Requirements

  • Relay client container (hosted by INFOnline or self-hosted)
  • Registered domain service name as CNAME (hosted by INFOnline), AAA(A) (self-hosted) DNS entry
  • Site ID (provided by INFOnline GmbH)

Preparations

AMP-optimized web content is measured via <amp-analytcis /> tags. This CustomElement and its implementation must be downloaded from the AMP CDN along with other AMP-related libraries by using this integration:

1
2
3
4
<head>
  <script async src="https://cdn.ampproject.org/v0.js"></script>
  <script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
</head>

Info

Both scripts should be placed in the <head> of the AMP-optimized web page.

The service platform (relay client) also provides the publisher with the <iframe> for communication between AMP and the census AMP sensor. The publisher can use the site-specific CNAME or AAA(A) DNS record to access this <iframe>. The subdomain criterion that Google specifies in this case is thus satisfied.

Example:

  • AMP web page -> https://www.example.com/start.html
  • <iframe> web page -> https://data-1a79a4d60d.example.com/iomb/latest/html/amp.html
Attention

INFOnline strongly recommends using the <iframe> from the service platform, as this guarantees stable functionality through regular updates.

Measurement of AMP web pages

To measure AMP web pages, you need to implement the <amp-analytics /> tag with an appropriate configuration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<amp-analytics type="infonline_base">
  <script type="application/json">
  {
    "vars": {
      }, "st": "example",
      "cp": "foo",
      "dn": "data-1a79a4d60d.example.com"
    },
      "requests": {
        "url": "https://data-1a79a4d60d.example.com/iomb/latest/html/amp.html"
    }
  }
  </script>
</amp-analytics>

Attention

Please make sure that you fill in the <amp-analytics /> tag with the correct <... type="infonline_base" /> type.

The following parameters can be passed using the <amp-analytics /> tag:

abbreviation name type standard length pattern mandatory description
st site string - 15 ^[a-zA-Z0-9_]*$ yes Site identifier
dn domainServiceName string - - INFOnline CNAME convention1 yes Domain Service Name (CNAME or AAA(A) Host)2
cn country Enum de - - no INFOnline country (de or at)
cp code string page code_non-assignable 256 [^a-zA-Z0-9,_/\-?#.] no page code for the IVW Kat 2.0 association
co comment string - 256 /[ -~]/ no optional comment
- requests string - - [domainServiceName]/iomb/latest/html/amp.html yes Include the necessary iFrame (hosted on the service platform)

1 INFOnline CNAME convention: /^(data-)([a-f0-9]{10})\.([a-zA-Z0-9][a-zA-Z0-9-_]{0,61})(?:\.([a-z]{2,62}))?\.([a-z]{2,62})$/

2 If the notation of dn / domainServiceName does not correspond to the INFOnline CNAME convention, no measurement will take place.

Attention

The following applies to parameters:
- Not set and the parameter is optional -> default value will be used!
- Not set and the parameter is mandatory -> processing is aborted and a message is logged on the browser console in debug mode!
- Each parameter is queried before processing!

Measurement of AMP stories

Measuring AMP stories is done in the same way as measuring AMP web pages, except that you need to configure the appropriate AMP-specific triggers:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
<amp-analytics type="infonline_base">
  <script type="application/json">
    {
      "vars": {
        }, "st": "example",
        "cp": "foo",
        "dn": "data-1a79a4d60d.example.com"
    },
    "requests": {
      "url": "https://data-1a79a4d60d.example.com/iomb/latest/html/amp.html"
    },
    "triggers": {
      "storyPageVisible": {
        }, "on": "story-page-visible",
        "request": "pageview"
      },
    }
  }
  </script>
</amp-analytics>

Pseudonymous measurement

Attention

If you activate pseudonymous measurement via the INFOnline Measurement Manager, it is mandatory to have the standalone script integrated in Google AMP article.

Prerequisites

  • Publisher site identifier provided by the INFOnline GmbH
  • Subdomain for the INFOnline AMP Iframe (Why?)
  • TCF 2.0 and AMP compliant CMP from certified vendors

Preparations

AMP optimized web content is measured via <amp-analytcis /> tags. This CustomElement and its implementation must be downloaded along with other AMP related libraries like the v0 runtime and the <amp-consent /> element from the AMP CDN using this integration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<head>
  <script async src="https://cdn.ampproject.org/v0.js"></script>
  <script
    async
    custom-element="amp-analytics"
    src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"
  ></script>
  <script
    async
    custom-element="amp-consent"
    src="https://cdn.ampproject.org/v0/amp-consent-0.1.js"
  ></script>
</head>

Both scripts should be placed in the <head> of the AMP optimized website.

Integration of a TCF 2.0 compliant CMP

For the integration of TCF 2.0 the publisher needs the CustomElement <amp-consent> and has to implement it according to the specifications of the CMP manufacturer (here an example with Consent Manager):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<amp-consent id="ConsentManager" layout="nodisplay" type="ConsentManager">
  <script type="application/json">
    {
      "postPromptUI": "postPromptUI",
      "clientConfig": {
        "id": "...Your CMP-ID...",
        "params": ""
      }
    }
  </script>
  <div id="postPromptUI">
    <button on="tap:ConsentManager.prompt()" role="button">
      Manage privacy settings
    </button>
  </div>
</amp-consent>

The publisher can control the blocking of <amp-analytics /> elements and other privacy-sensitive integrations like <amp-ad /> via a meta tag:

1
<meta name="amp-consent-blocking" content="amp-analytics" />

The <meta> tag should be placed in the <head> of the AMP optimized website.

warning

To block components, either the publisher have to add the data-block-on-consent attribute to the AMP component or add the amp-consent-blocking meta tag with the list of extensions to be blocked. Note, that if the publisher is using the type attribute for CMP integration, he must also include the amp-consent-blocking meta tag. This ensures that buildCallback of the component isn't called until consent has been accepted, or if consent is not required for the user based on the consentRequired value. In effect, this means that all behaviors of the element (e.g. sending analytics pings for <amp-analytics> or the loading of an <amp-ad>) are delayed until the relevant consent instance is accepted.

Hosting of INFOnline AMP iframe

The INFOnline AMP iframe which should be hosted on a subdomain of the HTTP-Origin or eTLD+1 of the AMP website has following code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>INFOnline Measurement pseudonymous google amp iframe</title>
  <script
    src="//script.ioam.de/sensor/latest/bootstrap/stub.js"
    type="text/javascript"
  ></script>
  <script
    src="//script.ioam.de/sensor/latest/bootstrap/amp.js"
    type="text/javascript"
  ></script>
</head>
<body>
<script
  src="//script.ioam.de/sensor/latest/standalone/amp/es5/bundle.js"
  type="text/javascript"
></script>
</body>
</html>

The publisher can use the site-specific subdomain to access this <iframe>, the subdomain criterion, that Google specifies in this case is thus fulfilled.

Example:

  • AMP web page -> https://www.example.com/start.html
  • <iframe> web page -> https://iframe.example.com/amp.html
warning

To avoid any problems with the URL whitelist (Localliste) of the digital site, it is important that the canonical URL or its correspondingly optimized version (e. g with wildcard notation) must be part of the url whitelist. The URL whitelist can be edited via the INFOnline Customer Center in the Localliste module.

Measurement of AMP web pages

In order to measure AMP web pages you have to implement the <amp-analytics /> tag with an appropriate configuration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<amp-analytics data-block-on-consent type="infonline">
  <script type="application/json">
    {
      "vars": {
        "st": "example",
        "cp": "foo",
        "co": "bar"
      },
      "requests": {
        "url": "https://iframe.example.com/amp.html"
      }
    }
  </script>
</amp-analytics>
warning

Please make sure to populate the <amp-analytics /> tag with the correct <... type="infonline" /> type.

warning

AMP does not (yet) support the blocking of specific vendors by using the IAB consent string. This means that (currently) the publisher can only use general blocking/unblocking for AMP and not specific blocking by vendor. In order to block INFOnline Measurement pseudonymous from publisher's AMP website when no consent is given by a user, he has to add the data-block-on-consent attribute to amp-analytics element (see above).

The following parameters can be provided via the <amp-analytics /> tag:

Abbreviation Name Type Default Length Pattern Mandatory Description
st site String - 15 ^[a-zA-Z0-9_]*$ yes Site identifier
cn country Enum de - - no INFOnline country (de or at)
cp code String Leercode_nichtzuordnungsfaehig 256 [^a-zA-Z0-9,_/\-?#.] no Page code for the IVW Kat 2.0 association
co comment String - 256 /[ -~]/ no Optional comment
warning

The following applies to parameters:

  • Not set and the parameter is optional -> Default value is used!
  • Not set and the parameter is mandatory -> processing will be aborted and a message is logged to browser console in debug mode!
  • Every parameter will be asserted before being processed!

Measurement of AMP stories

The measurement of AMP-Stories is taken in the same way as measurement of AMP web pages (page view) except that you must configure the relevant AMP-specific triggers:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
<amp-analytics data-block-on-consent type="infonline">
  <script type="application/json">
    {
      "vars": {
        "st": "example",
        "cp": "foo",
        "co": "bar",
      },
      "requests": {
        "url": "https://iframe.example.com/amp.html"
      }
      "triggers": {
        "storyPageVisible": {
          "on": "story-page-visible",
          "request": "pageview"
        },
      }
    }
  </script>
</amp-analytics>

Last update: July 19, 2023