Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: forumposters on June 09, 2006, 01:43:23 PM

Title: Google Analytics
Post by: 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?
Title: Re: Google Analytics
Post by: Oldiesmann on June 09, 2006, 01:51:25 PM
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.
Title: Re: Google Analytics
Post by: Niteblade 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.
Title: Re: Google Analytics
Post by: forumposters on June 09, 2006, 06:00:35 PM
How long does it take for analytics to update?  I've had the code there for hours and I see no stats yet.
Title: Re: Google Analytics
Post by: Niteblade on June 09, 2006, 10:12:39 PM
Give it at least one day to begin gathering information.

And you'll see all kinds of little dots over your map. :)
Title: Re: Google Analytics
Post by: efbl on December 16, 2007, 11:34:50 AM
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.
Code: [Select]
// 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>';

Title: Re: Google Analytics
Post by: 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 :)
Title: Re: Google Analytics
Post by: efbl on December 20, 2007, 07:43:31 AM
Tracking code installed. Thank you, Harro!
Title: Re: Google Analytics
Post by: foge on January 19, 2008, 05:25:00 AM
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!
Title: Re: Google Analytics
Post by: jarhaa on June 08, 2008, 01:36:22 PM
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>   :-\
Title: Re: Google Analytics
Post by: ApplianceJunk on June 09, 2008, 02:14:12 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.
Title: Re: Google Analytics
Post by: brygida on June 11, 2008, 05:41:14 PM
Thank you Harro!

for me also \ before (') worked 
at second time  :) the first i have missed one O:)
Title: Re: Google Analytics
Post by: Lautermilch on August 10, 2009, 11:14:34 PM

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");
Title: Re: Google Analytics
Post by: Arantor on August 11, 2009, 05:31:35 PM
Can we have some lines before that too?
Title: Re: Google Analytics
Post by: iamekim on September 04, 2009, 02:46:05 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. :)
Title: Re: Google Analytics Code
Post by: dgswilson on September 16, 2009, 08:14:23 AM
Yes, (\') was missing component. And yes - All.  Thanks a lot. What is, or maybe where is, "Tiny Portal"?

www.dgswilson.com/index.php
Title: Re: Google Analytics
Post by: sadiakomal on March 03, 2010, 04:55:00 PM
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"
Title: Re: Google Analytics
Post by: Arantor on March 04, 2010, 05:05:58 PM
sadiakomal, please attach your index.template.php file. Did you attempt to use the mod mentioned earlier in this thread or not?
Title: Re: Google Analytics
Post by: rostamiani on November 21, 2010, 06:59:59 PM
You can use this MOD  ;D :

http://custom.simplemachines.org/mods/index.php?mod=2210

Title: Re: Google Analytics
Post by: ronaldguilmet on February 23, 2012, 05:20:37 AM
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 (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.
Title: Re: Google Analytics
Post by: dotch on February 24, 2012, 04:28:33 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.

Same here, has been working for years.