Analytics code can be added to your Instant Article.
Analytics code is specified using the standard HTML
<figure> element, which wraps an
<iframe> element containing the analytics code. To embed analytics code within your Instant Article, apply the
op-tracker class to the
<figure> element enclosing the tracking code.
Anything within the
<iframe> will execute, but this webview will remain hidden from readers of your Instant Article. The canonical URL used within this
<iframe> will match the URL defined for your Article, so the analytics code will execute in the same environment as it does for the web version of your article.
Analytics code must appear in the body of the article and cannot appear in the header or footer.
The source of the content for your analytics code.
Add your analytics code in one of the following methods:
If your analytics code can be served directly from a specific URL, you can specify the URL using the src attribute on the
<figure class="op-tracker"> <iframe src="https://www.myserver.com/trackingcode"></iframe> </figure>
You can also embed the full unescaped set of HTML and scripts for your analytics code as text content within the
<figure class="op-tracker"> <iframe> <!-- Include full analytics code here --> </iframe> </figure>