dcsimg
www.webdeveloper.com
Results 1 to 5 of 5

Thread: inserting google analyitcs conflicts

  1. #1
    Join Date
    Jul 2011
    Posts
    8

    inserting google analyitcs conflicts

    Hi so im working with smarty templates, .tpl and .php. I inserted the GA code into the wrapper.tpl which is the main file for every page, and the code shows on every page as well. but GA is not recognizing it.
    {literal}
    <script type="text/javascript">
    (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-40922402-1', 'roflgold.com');
    ga('send', 'pageview');

    </script>
    {/literal}
    </head>

    the {literal} isn't working either. Any ideas what im doing wrong?

    www.roflgold.com

  2. #2
    Join Date
    May 2013
    Location
    Kansas City
    Posts
    21
    Try putting the google analytics code in a separate file, and calling it with a script src.
    You're probably running into parsing issues with smarty, because your start and end brackets are on the same line.
    There might be something you can do with the formatting, but putting it in a script file should work every time.

  3. #3
    Join Date
    Jul 2011
    Posts
    8
    Yup that fixed it. Thanks a bunch

  4. #4
    Join Date
    May 2013
    Location
    Kansas City
    Posts
    21
    No worries. Happy to help.

  5. #5
    Join Date
    Mar 2013
    Posts
    43
    Really a great information. Thanks for sharing and keep on updating..!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles