News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

I would like to add Google Analytics to my forum

Started by ResaleRipoffs.com, January 05, 2009, 03:09:13 PM

Previous topic - Next topic

ResaleRipoffs.com

I hope I am posting this in the correct place.  I am using SMF in a subdirectory of my website at hxxp:www.resaleripoffs.com/reports [nonactive] and would like to add Google Analytics to it along with adsense.  I have the code I need I'm just not sure where to put it.  Can anyone help?  I am sure the forum uses some soort of a template that if I put the code into that file it will automatically insert that code into each page on the forum.

BTW I noticed I posted this in the wrong place as I am using 1.1.7 only because I can't figure out how to upgrade to 2.0 beta 4

Thanks for the help.

ResaleRipoffs.com

I hope I am posting this in the correct place.  I am using SMF in a subdirectory of my website at hxxp:www.resaleripoffs.com/reports [nonactive] and would like to add Google Analytics to it along with adsense.  I have the code I need I'm just not sure where to put it.  Can anyone help?  I am sure the forum uses some soort of a template that if I put the code into that file it will automatically insert that code into each page on the forum.

BTW I am using 1.1.7 only because I can't figure out how to upgrade to 2.0 beta 4

Thanks for the help.

mashby

It appears that you are using the Default theme. Download the index.template.php file from /Themes/default/. Look for </body>. Insert your GA code right above that. Save and upload new file (keeping a backup just in case). If you are using any custom themes, rinse and repeat for each one.
Always be a little kinder than necessary.
- James M. Barrie

death_merc


brandonmccoy

download and install ad management
its perfect, itl tell you where and when you want the add to appear

or to keep the add on top or bottom of your forum
download and install global headers and footers

ResaleRipoffs.com

Quote from: brandonmccoy on January 05, 2009, 05:32:42 PM
download and install ad management
its perfect, itl tell you where and when you want the add to appear

or to keep the add on top or bottom of your forum
download and install global headers and footers

I saw a few mentions of that but SMF's download page told me it wasn't compatible with my version "1.1.7" which contradicts the description of the mod that says it is.  Is there a step by step guide on how to add the ad mod?

Also still looking for the answer on where to add the analytics code.  I am assuming index.template.php but where?

Cheers

ResaleRipoffs.com

Quote from: mashby on January 05, 2009, 04:13:36 PM
It appears that you are using the Default theme. Download the index.template.php file from /Themes/default/. Look for </body>. Insert your GA code right above that. Save and upload new file (keeping a backup just in case). If you are using any custom themes, rinse and repeat for each one.

Thanks for your response.  I am using the default theme.  I found the </body> tag that you spoke of and put the code right before it.  Here is the error I get:

Template 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 456

447:
448:    echo '
449:    </div>';
450:
451:    // The following will be used to let the user know that some AJAX process is running
452:    echo '
453:    <div id="ajax_in_progress" style="display: none;', $context['browser']['is_ie'] && !$context['browser']['is_ie7'] ? 'position: absolute;' : '', '">', $txt['ajax_in_progress'], '</div>
454: <script type="text/javascript">
455: var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

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

457: </script>
458: <script type="text/javascript">
459: try {
460: var pageTracker = _gat._getTracker("UA-6769360-1");


I know the code I am inserting is correct because I got it from a working page on that site.  When I first got the error I figured I copied the code wrong so I logged in to Analytics and got the code from them which also confirmed that it should be placed right before the </body>.  Any ideas?  I would also like some help with the adsense issue.  I can't figure out the admod install.

mashby

Yes, index.template.php. Find </body> and put the GA code before it. Upload new file. Another option is to install the Global Headers/Footers mod (very useful if you offer more than one theme).
Always be a little kinder than necessary.
- James M. Barrie

Afro

#8
Quote from: ResaleRipoffs.com on January 06, 2009, 10:32:11 AM
Quote from: brandonmccoy on January 05, 2009, 05:32:42 PM
download and install ad management
its perfect, itl tell you where and when you want the add to appear

or to keep the add on top or bottom of your forum
download and install global headers and footers

I saw a few mentions of that but SMF's download page told me it wasn't compatible with my version "1.1.7" which contradicts the description of the mod that says it is.  Is there a step by step guide on how to add the ad mod?

Also still looking for the answer on where to add the analytics code.  I am assuming index.template.php but where?

Cheers

Download ad management mod ...and install it. its compatible with 1.1.7...download it ..and then use 1.1.6 as the package parser..its all the same.

i added my own analytics with global headers and footers..its very useful

SlammedDime

SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Advertisement: