Facebook Instant Article with (not set) in Google Analytics
GA code like this should give you correct titles:
<script> ...ga('create', 'XX-XXXXXXXXX-X', 'auto');ga('require', 'displayfeatures');ga('set', 'campaignSource', 'Facebook');ga('set', 'campaignMedium', 'Social Instant Article');ga('set', 'title', 'IA - '+ia_document.title); // get your title ga('send', 'pageview');</script>
So with ia_document.title you can get article title correct in analytics.
Here is a Facebook's reference to the issue:https://developers.facebook.com/docs/instant-articles/analytics#analytics-services
Hope this helps.
The code that you've posted ends with:
ga('send', 'pageview', {title: 'POST TITLE'});
This is why 'POST TITLE' is coming up in GA. By editing this field, you can decide how it will be reported to GA.
There are a few answers that might be applicable here but I will show what requires the least modification here:
in your header:
<html <?php language_attributes(); ?> data-title="<?php echo get_the_title();?>">
You will need to replace your own logic for get_the_title()
some pages created by use of rewrites will not have an title. But for most usage it will suffice.
<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', 'ANALYTICS ID', 'auto'); ga('require', 'displayfeatures'); ga('set', 'campaignSource', 'Facebook'); ga('set', 'campaignMedium', 'Social Instant Article'); ga('send', 'pageview', {title: document.documentElement.getAttribute('data-title')});</script>