Title: Google Analytics code not working
Last modified: September 6, 2020

---

# Google Analytics code not working

 *  Resolved [whitehat123](https://wordpress.org/support/users/whitehat123/)
 * (@whitehat123)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-analytics-code-not-working/)
 * Hello.
    I am facing problem with Google Analytics.It does not monitoring traffic
   of Instant articles. Please share the code format to put in analytics.
 * Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [shawfactor](https://wordpress.org/support/users/shawfactor/)
 * (@shawfactor)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-analytics-code-not-working/#post-13369242)
 * this gives you a good explanation,
 * [https://developers.facebook.com/docs/instant-articles/analytics/](https://developers.facebook.com/docs/instant-articles/analytics/)
 * my pklugin will encloe everything you put in the tracking code field with:
 * ‘<figure class=”op-tracker”> and </figure> so you need to include the iframe 
   and the rest of the code, whatever that is.
 *  Thread Starter [whitehat123](https://wordpress.org/support/users/whitehat123/)
 * (@whitehat123)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-analytics-code-not-working/#post-13370185)
 * I paste this code and save.
 * <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&#8217](https://www.google-analytics.com/analytics.js&#8217);,’
   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>
 * After it got saved it looks like below:
 * <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](https://www.google-analytics.com/analytics.js)\’,\’
   ga\’);
 *  ga(\’create\’, \’UA-Xxxx\’, \’auto\’);
    ga(\’require\’, \’displayfeatures\’);
   ga(\’set\’, \’campaignSource\’, \’Facebook\’); ga(\’set\’, \’campaignMedium\’,\’
   Social Instant Article\’); ga(\’set\’, \’title\’, \’FBIA: \’+ia_document.title);
   ga(\’send\’, \’pageview\’);
 * </script> </iframe>
 *  Thread Starter [whitehat123](https://wordpress.org/support/users/whitehat123/)
 * (@whitehat123)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-analytics-code-not-working/#post-13370189)
 * I also put <iframe> </iframe>tags
 *  Plugin Author [shawfactor](https://wordpress.org/support/users/shawfactor/)
 * (@shawfactor)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-analytics-code-not-working/#post-13374733)
 * This is something yur server is doing in its handling of posted quoted text. 
   This is not an issue with my plugin. You would see similar issues when inputting
   similarly quoted strings elsewhere
 *  Thread Starter [whitehat123](https://wordpress.org/support/users/whitehat123/)
 * (@whitehat123)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-analytics-code-not-working/#post-13375001)
 * This code is working fine with other plugin s.So , this is not caused by server.
 *  Plugin Author [shawfactor](https://wordpress.org/support/users/shawfactor/)
 * (@shawfactor)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-analytics-code-not-working/#post-13377930)
 * Look the problems does exist at your end as the code works fine on my sites: 
   if you indicate another pkugin that handles this properly I see if I can find
   a solution for both. But bear in mind there a myriad of reasons plugins dont 
   work and without looking at your setup it is really hard to tell
 *  Plugin Author [shawfactor](https://wordpress.org/support/users/shawfactor/)
 * (@shawfactor)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-analytics-code-not-working/#post-13429275)
 * I am resolving this for good order. I will rcontinue to minitor the thread so
   feel free to repost and I wil re open it if required.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Google Analytics code not working’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/lh-instant-articles_53759e.svg)
 * [LH Instant Articles](https://wordpress.org/plugins/lh-instant-articles/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/lh-instant-articles/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/lh-instant-articles/)
 * [Active Topics](https://wordpress.org/support/plugin/lh-instant-articles/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/lh-instant-articles/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/lh-instant-articles/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [shawfactor](https://wordpress.org/support/users/shawfactor/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/google-analytics-code-not-working/#post-13429275)
 * Status: resolved