Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4269
Latest: Gatux
New This Month: 0
New This Week: 0
New Today: 0
Stats
Total Posts: 43593
Total Topics: 7567
Most Online Today: 76
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 43
Total: 43

Author Topic: how to insert Google analytics code  (Read 18972 times)

0 Members and 1 Guest are viewing this topic.

Offline ubintook

  • Member
  • *
  • Posts: 5
    • View Profile
how to insert Google analytics code
« on: October 08, 2009, 05:48:56 pm »
There has been a thread going at simple machine regarding insertion of Google analytics code
There does to seem to be any real agreement on the correct manner to insert the code.
i have tried most of the "common" ways but all end up in a parsing error.
I am using smf1.1.10 with a theme called outline form dziner studio
any suggestions?


Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16584
    • View Profile
Re: how to insert Google analytics code
« Reply #1 on: October 09, 2009, 09:34:03 am »
Just insert into index.template.php of the theme using an echo statement you  need to escape any of the 's to avoid parse errors.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline ApplianceJunk

  • Sr. Member
  • ****
  • Posts: 432
    • View Profile
    • ApplianceJunk.com
Re: how to insert Google analytics code
« Reply #2 on: October 09, 2009, 04:31:33 pm »
I just followed the instruction were I got the Google analytics code.  ;)

Quote
Copy the following code block into every webpage you want to track immediately before the </body> tag.

I placed the code in the index.template.php, immediately before the </body> tag. :)

Offline ubintook

  • Member
  • *
  • Posts: 5
    • View Profile
Re: how to insert Google analytics code
« Reply #3 on: October 09, 2009, 04:47:25 pm »
I just followed the instruction were I got the Google analytics code.  ;)

Quote
Copy the following code block into every webpage you want to track immediately before the </body> tag.

I placed the code in the index.template.php, immediately before the </body> tag. :)

I did that and get a parsing error...thats why i thought there was an issue.

Offline ubintook

  • Member
  • *
  • Posts: 5
    • View Profile
Re: how to insert Google analytics code
« Reply #4 on: October 09, 2009, 04:54:45 pm »
Just insert into index.template.php of the theme using an echo statement you  need to escape any of the 's to avoid parse errors.
Example?

here is my code(minus tracking number)
Code: [Select]
<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-8");
pageTracker._trackPageview();
} catch(err) {}</script>

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16584
    • View Profile
Re: how to insert Google analytics code
« Reply #5 on: October 12, 2009, 01:48:37 pm »
Below
Code: [Select]
echo '
<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-8");
pageTracker._trackPageview();
} catch(err) {}</script>
';
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline ubintook

  • Member
  • *
  • Posts: 5
    • View Profile
Re: how to insert Google analytics code
« Reply #6 on: October 12, 2009, 04:00:24 pm »
not sure what is happening, but i still get a parsing error, i have attached my index.template.php. ( i munged the Google code)
Now, i have been editing the file from within the theme that i am using, should i be editing a different one?
thoughts on why this is happening?


Offline ubintook

  • Member
  • *
  • Posts: 5
    • View Profile
Re: how to insert Google analytics code
« Reply #7 on: October 16, 2009, 02:30:37 pm »
a mod to insert analytics code has been created at the SMF forums:
http://www.simplemachines.org/community/index.php?topic=341997.0

Offline flodo

  • Member
  • *
  • Posts: 1
    • View Profile
Re: how to insert Google analytics code
« Reply #8 on: January 11, 2010, 05:09:13 am »
thanks :) :) :)

Offline insy111

  • Member
  • *
  • Posts: 2
    • View Profile
    • Wall Stickers India
Re: how to insert Google analytics code
« Reply #9 on: March 22, 2012, 06:24:50 am »
a mod to insert analytics code has been created at the SMF forums:
http://www.simplemachines.org/community/index.php?topic=341997.0

That's extremely helpful, thanks!

 

Related Topics

  Subject / Started by Replies Last post
6 Replies
8565 Views
Last post December 17, 2010, 11:51:27 am
by Michel68
15 Replies
14916 Views
Last post February 11, 2012, 12:08:07 pm
by SMFHacks
2 Replies
4359 Views
Last post July 16, 2012, 01:37:10 pm
by XHIBIT
2 Replies
2996 Views
Last post February 12, 2013, 06:49:50 pm
by tekgik
2 Replies
4859 Views
Last post February 23, 2014, 05:45:21 am
by Sweetwater

+- Recent Topics

Denying members some admin settings by rickk
November 17, 2024, 12:02:55 pm

Weird setup by SMFHacks
November 07, 2024, 06:37:41 am

Restoring a deleted photo by Monocero
November 01, 2024, 04:23:56 am

Gallery Pro reinstalation by Lirorobert
October 14, 2024, 01:43:43 am

Move picture from main gallery to user gallery by SMFHacks
October 11, 2024, 09:11:00 pm

quoting part of message by Lirorobert
October 04, 2024, 03:21:40 pm

Does SMF Gallery support by SMFHacks
October 02, 2024, 06:14:26 am

Item count on Gallery Tab shows double by SMFHacks
September 26, 2024, 12:59:20 pm

Forum post missing when image over 4000x pixels is uploaded to gallery by Michel68
September 24, 2024, 01:37:17 pm

Setting a photo as invisible by Monocero
September 17, 2024, 02:11:56 pm

Powered by EzPortal