Adding Google Analytics to phpBB2

Discussion about the Google Search Engine. SEO, PageRank, AdSense, AdWords, Use and other Services.

Moderator: Moderators

Adding Google Analytics to phpBB2

Postby bruce-banner » Mon Sep 28, 2009 2:22 pm

Hi all:
I am trying to add Google Analytics to a phpBB2 forum.
I added the code to all the templates that I found:

forums/templates/Igloo/overall_footer.tpl
forums/templates/subSilver/overall_footer.tpl
forums/templates/xand/overall_footer.tpl

In the Analytics reports I can read:

Waiting for Data
Analytics has been successfully installed and data is being gathered now.


but it's been like that for 3 days. Is there something that I am doing wrong?
bruce-banner
 
Posts: 4
Joined: Fri Sep 25, 2009 2:59 pm

Advertisement

Re: Adding Google Analytics to phpBB2

Postby Professional » Tue Sep 29, 2009 10:49 am

i suggest to put that code before overall_footer.html files.
just this :wink:
انجمن تخصصی نسل جدید موبایل ها- iUnlockiPhone
My Handwritings: Professional Dreams
Every Thing That U Feel,Is Every Thing That I Feel.
User avatar
Professional
PR5
PR5
 
Posts: 551
Joined: Mon Apr 07, 2008 5:41 am
Location: 1/2 of the World

Re: Adding Google Analytics to phpBB2

Postby bruce-banner » Tue Sep 29, 2009 2:23 pm

Hi professional:

What do you mean?

I have added the Analytics code before the </body> tag.
I can't find any html file in the template folders, just tpl files.

I have a phpBB2 forum.
bruce-banner
 
Posts: 4
Joined: Fri Sep 25, 2009 2:59 pm

Re: Adding Google Analytics to phpBB2

Postby Professional » Wed Sep 30, 2009 8:09 pm

sorry i think u wanted for phpbb3,for phpbb2 yes hust inser them before </body> at /your template/overall_footer.tpl :oops:
انجمن تخصصی نسل جدید موبایل ها- iUnlockiPhone
My Handwritings: Professional Dreams
Every Thing That U Feel,Is Every Thing That I Feel.
User avatar
Professional
PR5
PR5
 
Posts: 551
Joined: Mon Apr 07, 2008 5:41 am
Location: 1/2 of the World

Re: Adding Google Analytics to phpBB2

Postby dcz » Sat Oct 03, 2009 3:15 pm

bruce-banner wrote:Waiting for Data
Analytics has been successfully installed and data is being gathered now.



This should mean that everything is ok, any update on the actual results since your post ?
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21451
Joined: Fri Apr 28, 2006 9:03 pm

Re: Adding Google Analytics to phpBB2

Postby bruce-banner » Sat Oct 03, 2009 3:33 pm

Yes, it was a phpBB2 issue.

phpBB removes the final closing brackets from the tracking code when uploaded and you end up with
} catch(err) </script>
rather than
} catch(err) {}</script>.

Put a space between the brackets } catch(err) { }</script>, reupload and all will be well.

*** This worked well. Thanks to Daniel Jeffery from Google Analytics Help ***
bruce-banner
 
Posts: 4
Joined: Fri Sep 25, 2009 2:59 pm

Re: Adding Google Analytics to phpBB2

Postby dcz » Sat Oct 03, 2009 3:37 pm

Interesting, was an hard one to find, well done ;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21451
Joined: Fri Apr 28, 2006 9:03 pm

Re: Adding Google Analytics to phpBB2

Postby emcvay » Thu Oct 01, 2015 7:12 pm

Another post in an old thread (thanks for keeping them around).

Google seems to think you can just create a php file for their code and save it in /includes and then add:

Code: Select all
<body> tag:
<?php include_once("analyticstracking.php") ?>


to the template. I'm assuming the overallfooter.tpl should do it for the phpbb forum in a nuke site but what about just adding
Code: Select all
include_once("analyticstracking.php")
To the header or footer for the site?

Obviously you want the code to land on every possible page of the phpnuke site including the phpbb2 forum.

Ideas? Comments?
emcvay
 
Posts: 6
Joined: Wed Sep 30, 2015 2:29 am
Location: WA State

Re: Adding Google Analytics to phpBB2

Postby emcvay » Thu Oct 01, 2015 9:54 pm

Found the solution was much easier than I had thought. Simply put the script code into the header.php file right at the end of the php coding ;)

Like this:
Code: Select all
?>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'your google analytics code', 'auto');
  ga('send', 'pageview');

</script>


Seems to be working well on all pages this way as I've tracked my own travels through the site while watching the Real Time Overview in Analytics.
emcvay
 
Posts: 6
Joined: Wed Sep 30, 2015 2:29 am
Location: WA State


Return to Google Forum

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: AhrefsBot [Bot] and 2 guests


 
cron