Where to Add Google Analytics code

Support Forums Cian – WP Theme Where to Add Google Analytics code

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5361
    Sumit Rathore
    Participant

    I want to add the google analytics on my site. Where do I add the code. Currently they have these 2 options :-

    1) Website tracking
    This is the Universal Analytics tracking code for this property.
    To get all the benefits of Universal Analytics for this property, copy and paste this code into every webpage you want to track.

    2) PHP ImplementationOPTIONAL
    Use the code above to create a file named “analyticstracking.php”, and include the file on each PHP template page.
    Add the following line to each template page immediately after the opening <body> tag:

    <?php include_once(“analyticstracking.php”) ?>
    …………………………………..

    Which one shall I opt for and where ?

    Please provide detailed steps.

    – Sumit

    #5365
    CreaboxThemes
    Keymaster

    Hi Sumit,

    I use the first option. I have added the Universal Analytics tracking code in the option ‘Custom JS’ in the page ‘Appearance > Theme options > Custom Scripts’ in this way:


    (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', 'UA-43602612-12', 'auto');
    ga('send', 'pageview');

    Regards

    • This reply was modified 7 years, 10 months ago by CreaboxThemes.
    • This reply was modified 7 years, 10 months ago by CreaboxThemes.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.