Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4257
Latest: Alex998.
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43295
Total Topics: 7523
Most Online Today: 230
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 233
Total: 233

Author Topic: how to insert Google analytics code  (Read 18628 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: 16452
    • 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: 16452
    • 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
8359 Views
Last post December 17, 2010, 11:51:27 am
by Michel68
15 Replies
14266 Views
Last post February 11, 2012, 12:08:07 pm
by SMFHacks
2 Replies
4193 Views
Last post July 16, 2012, 01:37:10 pm
by XHIBIT
2 Replies
2918 Views
Last post February 12, 2013, 06:49:50 pm
by tekgik
2 Replies
4646 Views
Last post February 23, 2014, 05:45:21 am
by Sweetwater

+- Recent Topics

Please Help! by SMFHacks
April 17, 2024, 08:04:55 am

Rate own images by fvlog19
April 11, 2024, 10:56:53 am

Tidy Child Boards on 2.1.4 by SMFHacks
April 04, 2024, 03:54:12 pm

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
March 30, 2024, 12:41:08 pm

Can't DROP 'id_member'; check that column/key exists Datei: by SMFHacks
March 30, 2024, 11:58:20 am

No thumbnails on new uploads by Tonyvic
March 29, 2024, 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

Powered by EzPortal