News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Google analytics code

Started by lne, June 08, 2012, 09:41:11 AM

Previous topic - Next topic

lne

hi,

Just installed SMF in my sub-directory. Looks nice as of now. Anyway, in my root domain I have my wordpress blog installed and in a sub-directory, I got the SMF. I have Google analytics code installed in the footer.php of my wordpress blog. Now, the question is:


  • Do I have to place the tracking code once again (since my root domain has already installed)
  • If yes, how and where ( I dont want to use any mod, unless very necessary)
  • If I have install new tracking code, then do I have to create a new profile in my google analytics account with my forum?

Please try to help me and get my answer.

Thank you in advance,

Kalyan

Arantor


lne

Quote from: Arantor on June 08, 2012, 09:49:12 AM
1. Yes.
2. http://custom.simplemachines.org/mods/index.php?mod=2210
3. Use the same details for Google Analytics.

Thanks,, but is it possible to things without any mod? I believe using too many mod will eat up more server resources (like those of wordpress plugins)

You said, yes, which mean, I will have two profiles then in my GA account to view... I cannot find all the tracks in my single page?

ApplianceJunk

You can just insert the Adsense code manually if you don't want to use a mod to do it.

Arantor

I wrote that mod originally specifically to avoid all the problems that will invariably be had doing it manually - unless you're fluent in PHP, invariably it's going to go wrong trying to add it manually into the template, as all the people who get 'Template Parse Errors' have demonstrated...

Xenocidius

Mods, particularly simple ones like that, shouldn't eat up many server resources, and the Google Analytics mod is well worth it for customization ability and use of integration hooks to minimize code changes and easily work across all themes.

However, if you insist, go to each of your theme directories and modify index.template.php. Search for </head> and paste the code right before that.

Arantor

And hope you manage to escape all the apostrophes correctly in the process...

Xenocidius

Yes, and that. You could find </head> and paste right before it:

' . "<script type=\"text/javascript\">{{code without script tags}}</script>" . '

But I'd strongly recommend using the mod.

lne

Well, as you all confirm and assure, I will try out the mod and use it on my blog. thank you everyone for your answers.. just one more confusion, I have to create another profile with the mod (such as lifeandexperiences.com/forum/index.php [nofollow]) in google analytics account.

Alas! :( I can't see the consolidated data of both my blog's visitors and my forum visitors in one place.. that would have been good if that happens at all.

ApplianceJunk

Quote from: Arantor on June 08, 2012, 10:17:33 AM
I wrote that mod originally specifically to avoid all the problems that will invariably be had doing it manually - unless you're fluent in PHP, invariably it's going to go wrong trying to add it manually into the template, as all the people who get 'Template Parse Errors' have demonstrated...

Don't know if I ever seen that mod before or what, but I'm using it now. :)

I had been putting my analytics code on our site using one of the SMF Ad mods and placing it with the footer.

Nice job on the mod. You could not have made it any easier for the user, thanks.

lne

Just installed the mod http://custom.simplemachines.org/mods/index.php?mod=2210, added the Property ID & now waiting for the report after 24 hours.

Advertisement: