Analytics
3.9K members online now
3.9K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

How to track instant Articles in Google Analytics ?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I wanted to track the traffic coming from Instant Articles and I happened to found a customize GA code from stackoverflow.

 

<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','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-9999999-9', 'mydomain.com');

ga('require', 'displayfeatures');

ga('set', 'campaignSource', 'Facebook');

ga('set', 'campaignMedium', 'Social Instant Article');

ga('set', 'title', 'My post title here');

ga('send', 'pageview');

</script>

</iframe>

</figure>

 

The above code is functioning but there is a doubt on its feasibility. If I sort the traffic according to the facebook and device, it also shows traffic coming from desktop devices.

 

How can we approch to track instant articles in GA ?

How to track instant Articles in Google Analytics ?

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

That is a really good question,  I would assume you should not see any desktop traffic as IA is mobile focused and will not even display if you use chrome and resize for mobile devices while testing.  I would really like to know what have you found out since pointing this question.

Please share Smiley Happy

How to track instant Articles in Google Analytics ?

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

 

We were now able to figure the tracking instant articles in GA.

 

Here's the modified version of the code that should go into the Facebook Instant article Source code.

 

<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-9999999', 'auto');
              ga('set', 'campaignSource', 'Facebook');
              ga('set', 'campaignMedium', 'Facebook Instant Articles');
              ga('set', 'referrer', 'ia_document.referrer');
              ga('send', 'pageview');
        
        </script>
    </iframe>
</figure>
You need to mention the campaign source and medium so as to get this traffic segregated in GA.
The referrer code is to bypass the Facebook referrer information in GA
The referral should come as ia.facebook.com
 

How to track instant Articles in Google Analytics ?

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Brilliant! thank you for spelling it out so clearly Smiley Happy

 

 

How to track instant Articles in Google Analytics ?

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hi 

Is this code still work?

Currently, I tried this one and still no data on GA at all Smiley Sad

<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', 'YOUR_UID_REPLACE_THIS', 'auto');
  ga('require', 'displayfeatures');
  ga('set', 'campaignSource', 'Facebook');
  ga('set', 'campaignMedium', 'Social Instant Article');
  ga('set', 'title', ia_document.title);
  ga('send', 'pageview');

</script>

How to track instant Articles in Google Analytics ?

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

I need to understand 2 things, please - 
1) How should I setup the Segment in GA for Instant Articles?

2) How long does it take after implementing the GA codes in the plugin to reflect into the GA?

 

Please help.

 

How to track instant Articles in Google Analytics ?

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

I've tried this code, it worked on iPhone but not on Android. I've tried that on development, not on production.

Is there any problem on Android?

How to track instant Articles in Google Analytics ?

Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭

We used this code, but for some reason under Content Drilldown it's creating a new page path level of /2/ and then it's almost impossible to tell which story is which because it appears as /2/39f368c5-fc84-4137-8abc-fb9d51befc08. We can add a secondary dimension to see the page title, but several of them are (not set). 

 

Any ideas? 

How to track instant Articles in Google Analytics ?

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭

which properties are inside the object ia_document other than title and referrer?