• therethere

    (@emotionaltrash)


    Hello there,

    we have some issues on setting title on google analytics tracker so we can get the instant article title on google analytics.

    Here what’s the code we are using:

    <!– START Google Analytics –>
    <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;,’ga’);

    ga(‘create’, ‘UA-XXXXXXXX’, ‘auto’);
    ga(‘require’, ‘displayfeatures’);
    ga(‘set’, ‘campaignSource’, ‘Facebook’);
    ga(‘set’, ‘campaignMedium’, ‘Instant Articles’);
    var titleIA = ia_document.title;
    ga(‘send’, ‘pageview’, {title: ‘+titleIA+’});

    </script>

    For some reason the variable titleIA is not working, any tips?

    many thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The code I’m using:

    <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;,’ga’);

    var title = ia_document.title;

    ga(‘create’, ‘UA-xxx-x’, ‘auto’);
    ga(‘require’, ‘displayfeatures’);
    ga(‘set’, ‘campaignSource’, ‘Facebook’);
    ga(‘set’, ‘campaignMedium’, ‘Social Instant Article’);
    ga(‘set’, ‘title’, title);
    ga(‘send’, ‘pageview’);
    </script>

    Thread Starter therethere

    (@emotionaltrash)

    i’d set up that way but on publishing tools on facebook the instant articles code still shows

    ga(‘set’, ‘title’, title);

    The title of the article don’t show up on the title variable ??

    I just added my own fresh solution to stack overflow and the github for this plugin:

    https://github.com/Automattic/facebook-instant-articles-wp/issues/321

    Unfortunately I don’t think it’s something they can fix on the plugin side, you need to look at those solutions and create your own code to paste in the plugin setting for analytics code.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Instant Articles google analytics article title’ is closed to new replies.