Results 1 to 4 of 4

Adding Code After Analytics

This is a discussion on Adding Code After Analytics within the Troubleshooting forums, part of the vBSEO SEO Plugin category; I need to add HTML Code: <script src= "/clktrk. js " type= "text/javascript" > </script> When I add it to ...

  1. #1
    Senior Member Citricguy's Avatar
    Real Name
    Josh
    Join Date
    Nov 2006
    Location
    Maui, Hawaii
    Posts
    143
    Liked
    0 times
    Blog Entries
    7

    Adding Code After Analytics

    I need to add

    HTML Code:
    <script src="/clktrk.js" type="text/javascript"></script>

    When I add it to the very bottom of the footer template it still shows up above the Analytics code.

    Here's what I need

    HTML Code:
    <!-- ANALYTICS STUFF :) -->
    <script src="/clktrk.js" type="text/javascript"></script>
    </body>

  2. #2
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    vbseo uses a template replace realtime

    psuedo-code:

    replace($output, '</body>', 'GA code </body>')


    In order to get it after this, you will need to make a plugin with a higher execution order than vbseo (5) so it runs after and does the same thing.

    Or, you can direct-edit the vbseo file that does it,

    includes/functions_vbseo.php

    line 1774

    find

    Code:
    $newtext = preg_replace('#(</body>)#is','
    <script type="text/javascript"><!--
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
    //-->
    </script>
    <script type="text/javascript"><!--
    var pageTracker = _gat._getTracker("'.VBSEO_ANALYTICS_CODE.'");
    pageTracker._initData();
    '.$more_tracking.'
    pageTracker._trackPageview('.($track_url?"'$track_url'":"").');
    //-->
    </script>
    '.'\\1',$newtext,1);
    }
    replace with

    Code:
    $newtext = preg_replace('#(</body>)#is','
    <script type="text/javascript"><!--
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
    //-->
    </script>
    <script type="text/javascript"><!--
    var pageTracker = _gat._getTracker("'.VBSEO_ANALYTICS_CODE.'");
    pageTracker._initData();
    '.$more_tracking.'
    pageTracker._trackPageview('.($track_url?"'$track_url'":"").');
    //-->
    </script>
    <script src="/clktrk.js" type="text/javascript"></script> 
    '.'\\1',$newtext,1);
    }

  3. #3
    Senior Member Citricguy's Avatar
    Real Name
    Josh
    Join Date
    Nov 2006
    Location
    Maui, Hawaii
    Posts
    143
    Liked
    0 times
    Blog Entries
    7
    Thank you Brian, that worked flawlessly!

    While on the topic, might I ask, do you and if so how do you track ad-clicks on your sites?

  4. #4
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    I do not track other than the adsense report itself.

Similar Threads

  1. New Google Analytics code
    By hiken in forum Sitemap Features Archive
    Replies: 1
    Last Post: 08-21-2008, 08:20 PM
  2. About new Analytics code
    By bonjurkes in forum General Discussion
    Replies: 2
    Last Post: 01-23-2008, 07:00 PM
  3. how to install analytics code
    By BOLT in forum General Discussion
    Replies: 2
    Last Post: 06-17-2007, 07:46 PM
  4. How do I add the Google Analytics Code?
    By Lammypie in forum General Discussion
    Replies: 10
    Last Post: 05-22-2006, 08:08 PM

Posting Permissions

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