Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #47310
    sbartsch
    Participant

    Hi Sakin,

    I have a brief question. The university I work at would like to also track google analytics of my WordPress site through their own UA code. I already have a code and am internally tracking it through Yoast, and I don’t want to lose that data.

    I was told that I could put the script (below) with the appropriate UA code on my template header. Could you tell me exactly where I should place it? Would it be “Appearance > Editor > Header (header.php)?

    Here is the script:
    _____________________________________________________________________
    <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’, ‘————–‘, ‘auto’);
    ga(‘send’, ‘pageview’);

    </script>
    ____________________________________________________________________

    Any info at your convenience would be greatly appreciated.

    Many thanks,

    SBartsch

    #47321
    Sakin
    Keymaster

    @sbartsch: To add google analytics code in header. You can just go to “Appearance => Theme Options => Webmaster Tools = Header and Footer Codes”. Then paste your code at “Code to display on Header” box.

    #47359
    sbartsch
    Participant

    Thank you!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Adding Script to header | Google Analytics Tracking’ is closed to new replies.