News:

Wondering if this will always be free?  See why free is better.

Main Menu

Google Analytics

Started by tflnetwork, July 08, 2008, 01:33:29 PM

Previous topic - Next topic

tflnetwork

I can't seem to get it to work. I always get a template error.

This is my code:
Quote<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("UA-1854832-36");
pageTracker._initData();
pageTracker._trackPageview();
</script>
Where should i put it?

DonGiovanni

here is where i put it

// 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 src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "";
urchinTracker();
</script>

</body></html>';

LOADING...

// 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 src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>

<script type="text/javascript">
_uacct = "";
urchinTracker();
</script>

</body></html>';

tflnetwork


ellion

can any body tell me what might be wrong with this?

i insert the code where i would normally place tracking code. the line before </body>

exactly the same as the code in the post above. but i am getting an error.

DonGiovanni


ellion

this

QuoteTemplate Parse Error!
It seems something has gone sour on the forum with the template system. This problem should only be temporary, so please come back later and try again. If you continue to see this message, please contact the administrator.

You can also try refreshing this page.

refreshing the page doesnt help, and i dont want to wait and come back later.


DonGiovanni

Use this. This will work.



   // 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 src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "";
urchinTracker();
</script>

</body></html>';



or post your index.template.php and will see what's the error

ellion

hi i have tried it again and have got this error. i have had this error before, one of the times when i tried.

QuoteTemplate Parse Error!
There was a problem loading the /Themes/default/index.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in .../Themes/default/index.template.php on line 561

552:    echo '
553:    </div>';
554:
555:    // The following will be used to let the user know that some AJAX process is running
556:    echo '
557:    <div id="ajax_in_progress" style="display: none;', $context['browser']['is_ie'] && !$context['browser']['is_ie7'] ? 'position: absolute;' : '', '">', $txt['ajax_in_progress'], '</div>
558:
559:    <script type="text/javascript">
560: var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

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

562: </script>
563: <script type="text/javascript">
564: var pageTracker = _gat._getTracker("UA-4588964-2");
565: pageTracker._initData();


i have attached my index.template.php also

Briankbc

A complete solution has been written specifically for Simple Machines at:
Analytix Specifix: GA for Simple Machines Forum Software [nofollow]

Advertisement: