News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Google Analytics

Started by forumposters, June 09, 2006, 01:43:23 PM

Previous topic - Next topic

forumposters

SMF Version: SMF 1.1 RC2
What would be a good file to place Google Analytics code in so that it loads on everypage?

Oldiesmann

Put it right before the </body> tag in index.template.php. You'll have to do this for every theme, but it will load on ever page.
Michael Eshom
Christian Metal Fans

Niteblade

Personally, I put the code inside a javascript / html block in Tiny portal. It's been working fine there. I also put it inside my 'shop' .

Analytics is cool.
affiliate blog

forumposters

How long does it take for analytics to update?  I've had the code there for hours and I see no stats yet.

Niteblade

Give it at least one day to begin gathering information.

And you'll see all kinds of little dots over your map. :)
affiliate blog

efbl

Hello,

I have problem with Google Analytics tracker, the forum returns me an error when I reload it.

I use SMF 1.1.4 and Blue Blaze theme.

// 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">
[ * * * Google script * * * ]
</script>


</body></html>';


Harro

Make sure that all singles quote (') in the google script part have a \ before them.
Should work fine then :)

efbl

Tracking code installed. Thank you, Harro!

foge

Quote from: Harro on December 16, 2007, 04:42:33 PM
Make sure that all singles quote (') in the google script part have a \ before them.
Should work fine then :)

What a coincidence - I desperately needed this information just when SMF server got this meltdown. I found numbers of solutions which weren't working. I even searched pages where I couldn't read anything else than these scripts, Arabic, Asian languages, what ever. Internal search is still not working here, but I found this with google search and after trying to do this three days and then see how simple solution there is, makes me wanna scream :) Thx Harro!

jarhaa

#9
I tried this solution too but it didn't help. I am using "SlickPro" theme from metalcore.
Should I put that slash before EVERY (')   ?

Edit. I got it working... Needs to be JUST before </body>   :-\

ApplianceJunk

Quote from: nite0859 on June 09, 2006, 05:18:25 PM
Personally, I put the code inside a javascript / html block in Tiny portal. It's been working fine there. I also put it inside my 'shop' .

Analytics is cool.

Good idea with the TP block.

brygida

Thank you Harro!

for me also \ before (') worked 
at second time  :) the first i have missed one O:)

Lautermilch


I get this error code:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in .../Themes/BlackRainV2118/index.template.php on line 178
169:
170:             current_header_ic = mode;
171:          }
172:       // ]]></script>
173: </head>
174:
175:
176: <script type="text/javascript">
177: var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
178: document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
179: </script>
180: <script type="text/javascript">
181: try {
182: var pageTracker = _gat._getTracker("UA-9788839-1");

Arantor

Can we have some lines before that too?

iamekim

Quote from: Harro on December 16, 2007, 04:42:33 PM
Make sure that all singles quote (') in the google script part have a \ before them.
Should work fine then :)

so much help. thank you Harro. :)

dgswilson

#15
Yes, (\') was missing component. And yes - All.  Thanks a lot. What is, or maybe where is, "Tiny Portal"?

www.dgswilson.com/index.php

sadiakomal

when i try to past the code in index.template, its shows error and i have uploaded theme again i am using CS classic them "islamabadcommunity.com"

Arantor

sadiakomal, please attach your index.template.php file. Did you attempt to use the mod mentioned earlier in this thread or not?

rostamiani


ronaldguilmet

Quote from: forumposters on June 09, 2006, 01:43:23 PM
SMF Version: SMF 1.1 RC2
What would be a good file to place Google Analytics code in so that it loads on everypage?

just use this mod http://custom.simplemachines.org/mods/index.php?mod=351 and copy and past your code into the header. no code hacking required. worked great for me.

Advertisement: