Facebook Instant Article(FBIA)’s ia_document object (for analytics) and its properties in detail?

1k views Asked by At

I'm trying to track google analytics data for Author in Facebook Instant Articles (FBIA). Please see the comment in the example given below:

<item>
<title>
Article's Title
</title>
<description>Article's description</description>
<link>http://www.example.com/7216240</link>
<guid>7216240</guid>
<pubDate>Mon, 28 Aug 2017 10:31:50 +0200</pubDate>
<author>Author Name</author> // <-- This is the tag that I want to track in analytics
<content:encoded>
<![CDATA[
<!doctype html> <html lang="en" prefix="op: http://media.facebook.com/op#"> <head> ... </head> <body> <article> 
...
</article> </body> </html>
]]>
</content:encoded>
</item>

According to facebook for developers' documentation on Analytics for Instant Articles:

Facebook also exposes a defined set of Instant Article data, which the analytics trackers can use optionally. For JavaScript tracking codes, that data is available in the ia_document JavaScript object.

<figure class="op-tracker">
      <iframe>
          <script>
              // The URL the user shared
              var urlSharedByUser = ia_document.shareURL;

              // The article title
              var title = ia_document.title;

              // Referrer is always set to 'ia.facebook.com'
              var referrer = ia_document.referrer;
          </script>
      </iframe>
</figure>

However, it doesn't describe in detail which properties are inside the ia_document object.

A few Q&A on SO explain only with limited examples, something like

<figure class="op-tracker">
<iframe>         
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-XXXXXXXX-X', 'auto');
  ga('require', 'displayfeatures');
  ga('set', 'campaignSource', 'Facebook');
  ga('set', 'campaignMedium', 'Social Instant Article');
  ga('set', 'title', ia_document.title);
  ga('set', 'referrer', ia_document.referrer);
  ga('send', 'pageview');

</script>
</iframe>
</figure>

Is there any article that explains Facebook Instant Article(FBIA)’s ia_document object (for analytics) and its properties in detail?

What else do we have other than ia_document.title, ia_document.shareURL and ia_document.referrer? in my case, do we have ia_document.author?

1

There are 1 answers

1
Aung Myo Linn On BEST ANSWER

Just figured out that there's a browser debugging tool which provides an approximation of the Instant Articles environment. So let me just answer my own question. The URL for the browser debugging tools is as below:

www.ia-tracker.fbsbx.com/instant_article_test?url=<share-url>

After testing it in a browser console, I can conclude that there are only 3 properties that belong to ia_document, which are ia_document.title, ia_document.shareURL and ia_document.referrer.

See the screenshot below: enter image description here