This topic has 2 replies, 2 voices, and was last updated 9 years by pihla.

  • Author

    Tagged: 

  • #37311
     pihla
    Participant

    I attached analytics code to the javascript code section in general theme settings, but it does not work, analytics can not find the code.

    I attached the code like this:
    <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’, ‘UA-57267937-1’, ‘auto’);
    ga(‘send’, ‘pageview’);

    </script>

    And also tried

    (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-57267937-1’, ‘auto’);
    ga(‘send’, ‘pageview’);

    neither is working.

    I tried also to put the code in the header.php and footer.php files, but they did not work. I even tried to make an own .js file and attached that into header, but it did not work.

    Can you tell me what is wrong? Analytics says that it can not find the code in my sites homepage.

    #37331
     sharmstr
    Moderator

    Hmmm. I’m using analytics the way you’re trying to do it. You definitely have to wrap it with <script> tags like you have in your first example. You say google cant find it, but have you looked at your page source? Right click on any page, crt F to find GoogleAnalyticsObject.

    Also, verify that you dont have fancy quotes. They are present in the code examples you provided, but that could be this site doing that when you pasted it here.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #37459
     pihla
    Participant

    Hello,

    I haven’t got a clue what happened, but now it seems to work. So I’m happy, thanks for the support!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Cant get analytics to work’ is closed to new replies.

Log in with your credentials

Forgot your details?