News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

adding Google Analytics HELP!!!

Started by tittiger, January 08, 2009, 08:11:22 PM

Previous topic - Next topic

tittiger

I found a post that said to paste in the Google code right before the </body> tag and have done
that.

Here is the part of the file that I edited:

// The following will be used to let the user know that some AJAX process is running
   echo '
   <div id="ajax_in_progress" style="display: none;', $context['browser']['is_ie'] && !$context['browser']['is_ie7'] ? 'position: absolute;' : '', '">', $txt['ajax_in_progress'], '</div>

<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">
try {
var pageTracker = _gat._getTracker("UA-5393646-3");
pageTracker._trackPageview();
} catch(err) {}</script>

</body></html>';
}






IT didn't work  - I  broke the forum and I had to revert back to the original file! So I still need help!

This is the error I get on the forum with the edited file:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in .../Themes/AgistiTheme/index.template.php on line 418

409:
410:    echo '
411:    </div>';
412:
413:    // The following will be used to let the user know that some AJAX process is running
414:    echo '
415:    <div id="ajax_in_progress" style="display: none;', $context['browser']['is_ie'] && !$context['browser']['is_ie7'] ? 'position: absolute;' : '', '">', $txt['ajax_in_progress'], '</div>
416: <script type="text/javascript">
417: var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

418: document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

419: </script>
420: <script type="text/javascript">
421: try {
422: var pageTracker = _gat._getTracker("UA-5393646-3");


Perhaps it has to do  with the " agisti" theme I am using?



Attached is the correct file.   ::)

JimM

Please do not double post.

Topic locked.
Jim "JimM" Moore
Former Support Specialist

Advertisement: