Analytics

Analytics

WP Native Articles can automatically add the correct tracking code for multiple Analytics services. Navigate to the Analytics sub menu and enable the services you wish to include. Once a service is enabled you'll be given the option to enter your custom ID for that service. You can enable as many services as you like.

Supported analytics services:

  • Google Analytics
  • Google Site Tag
  • Jetpack
  • Simple Reach
  • Parse.ly
  • Chartbeat
WP Native Articles will automatically work with the official WordPress plugins for all these services. If you have any of the official plugins active we'll use the settings from that plugin by default.
Custom Analytics

The custom analytics box is a free form textarea, meaning you can add as many or as few analytics scripts as you like. They will automatically be wrapped in a <figure class="op-tracker"> tag to make them compatible for Instant Articles.

Google Analytics

You can use the code to add Google Analytics to your Instant Articles. Don't forget to replace YOUR-ANALYTICS-ID with your actual Google Analytics ID

          <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', 'YOUR-ANALYTICS-ID', 'auto');
          ga('require', 'displayfeatures');
          ga('set', 'campaignSource', 'Facebook');
          ga('set', 'campaignMedium', 'Social Instant Article');
          ga('send', 'pageview', {title: ia_document.title});
          </script>
          

Analytics Custom Post Dimensions

As of v1.3.4 you can now use certain post placeholders in your Analytics code.

For example, if you wanted to associated posts with your authors in Google Analytics and you'd set it up as dimension, you could add the following code to your Google Analytics.

          ga('set', 'dimension1', '{post_author_id}');
          

Analytics Placeholders

          {post_title}	
          {post_id}	
          {post_type}	
          {post_status}	
          {post_published_date}	
          {post_modified_date}	
          {post_author}	
          {post_author_id}	
          {blog_id}