Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: tittiger on January 08, 2009, 08:13:55 PM

Title: HELP with adding Google Analytics! PLEASE
Post by: tittiger on January 08, 2009, 08:13:55 PM
I found a post that said to paste in the Google code right before the </body> tag and have done
that -- seems to be what you did on the previous file.

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.   ::)
Title: Re: HELP with adding Google Analytics! PLEASE
Post by: JimM on January 08, 2009, 08:25:19 PM
Please do not double post.

Most folks use this mod to handle things like this:

http://custom.simplemachines.org/mods/index.php?mod=255
Title: Re: HELP with adding Google Analytics! PLEASE
Post by: tittiger on January 08, 2009, 09:02:16 PM
I did not mean to double post the browser hung my friend.

Your link is not what I was asking for.    I am having trouble with Google Analytics.

Thanks
Joe
Title: Re: HELP with adding Google Analytics! PLEASE
Post by: JimM on January 08, 2009, 09:59:13 PM
You are absolutely right.  My apologies.

This appears to be the same issue that you posted in this topic as well.  It is much easier for us if your issue is in one topic only.

http://www.simplemachines.org/community/index.php?topic=284579.msg1868442#msg1868442