How to Set Up Google Analytics to Track Facebook Instant Traffic

Over the last month or two I have been fighting Facebook Instant.  At first it was due to their slow, manual review process for approving new websites trying to utilize Facebook Instant.  My client’s theme and usage of embeds caused numerous problems for Facebook’s parsing code and the WordPress plugin made to make this integration ‘easy’ did no such thing.  Instead it shipped from Automattic with multiple bugs and was widely panned by users resulting in an average review of 2.6 out of 5 stars.

However, I was persistent, as was my client that we needed to get up and going with Facebook Instant so I kept pushing.  I finally was able to fix the issue of embeds being incorrectly parsed by Facebook and joy of all joys, have my client’s website approved for Facebook Instant.  Right away, the benefits of Facebook Instant were pretty obvious – the fast load times were fantastic and we used Facebook’s native advertising system to generate revenue and since they are a fairly large website, they did quite well.  However, one thing gnawed at me – distinguishing the traffic from regular Facebook traffic within Google Analytics.

While Automattic’s Facebook plugin had a spot to include Google Analytics code and Facebook also provided a best practice document to utilize Analytics, I simply couldn’t figure out how to make it play nice with the plugin and the existing Analytics code we used.  Finally one day I hit upon the right combination.  In an effort to help you if you are in a similar place, below you will see the code I used and a screenshot of how it looks within the Facebook Instant plugin for WordPress.  My hope is that by following the steps below, you are able to save time and start tracking your website starting today.

Step 1: Install Automattic’s much improved (they released an update 2 weeks ago that fixed many issues) Instant Articles for WP plugin and make sure your website is approved for Facebook Instant and set up correctly (I know, easier said than done).

Step 2: Go find your existing Google Analytics code within the admin section of Google Analytics.

It will look something like this –

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

ga(‘create’, ‘SITETRACKINGID‘, ‘auto’);
ga(‘send’, ‘pageview’);


The part that says SITETRACKINGID will be your specific site tracking ID and you will want to fill it in.

Step 3: Add the necessary additional information as shown below in the bold print.

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
ga(‘create’, ‘SITETRACKINGID‘, ‘auto’);
ga(‘require’, ‘displayfeatures’);
ga(‘set’, ‘campaignSource’, ‘Facebook’);
ga(‘set’, ‘campaignMedium’, ‘Social Instant Article’);
ga(‘send’, ‘pageview’, {title: ‘POST TITLE’});

Step 4: Remember to change the SITETRACKINGID to your correct Google Analytics ID.  You don’t need to modify any of the other code.

Step 5: Copy the code you created in step 3 and 4 and paste it into this box within the Instant Article for WP plugin.


Step 6: Check the box from the screenshot that says ‘Enable custom embed code’.

Step 7: Save the plugin screen.

You are done!  Remember that historical Facebook Instant articles won’t be updated unless you delete them and republish them.  However going forward, you should be able to see traffic within Google Analytics.  You can find it anywhere you can use the Source/Medium field.  This screenshot gives an example of how it will show up.



By |2018-01-13T01:56:28+00:00August 16th, 2016|Blog|3 Comments


  1. […] você pode combinar a análise do Analytics com os dados disponibilizados pelo próprio Facebook ou configurar a página e o Analytics para contabilizar esses […]

  2. […] a análise do Analytics com os dados disponibilizados pelo próprio Facebook ou configurar a página e o Analytics para contabilizar esses […]

  3. Husni's Elemento November 4, 2017 at 6:13 pm

    Google Analytics recently updated its tracking code to the Global Site Tag or gtag.js format.

Comments are closed.

Subscribe To Our Newsletter
Our owner writes a monthly newsletter - sign up today and see why folks say, "It never fails to include words".
Stay Updated
Give it a try, you can unsubscribe anytime.