1 of 3
1
Google analytics with EE
Posted: 07 May 2008 10:15 PM   [ Ignore ]  
Lab Assistant
RankRank
Total Posts:  102
Joined  12-26-2005

Hey all,

I have a somewhat unique business model with my site.  I have aggregated writers and pay them based on traffic they bring to the site via their individual blogs under our URL.  I track this information with Google Analytics.

My server stats are showing approx. 50% higher than my Google Analytics data.  I realize I don’t have the GS code on every page rendered by EE.  I also understand, that it’s likely there’s no way to do that simply without either pasting a global variable code, or the entire GA.js code.

Am I missing something?  Is there a better tool.  Is ther a simple way of getting that GA code on every page?

Thanks!

Moderators note: Split from this thread

Profile
 
 
Posted: 08 May 2008 02:46 AM   [ Ignore ]   [ # 1 ]  
Summer Student
Avatar
Total Posts:  14
Joined  02-10-2008

What about pasting GA code in the footer, if you have one, repeated on every page?

 Signature 

http://www.serafico.net

Profile
 
 
Posted: 08 May 2008 02:58 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  811
Joined  02-15-2008

I do as Serafico said, which is to just pop the Analytics code at the bottom of my footer embed, which is called on each page. Or of course you could create a specific Google Analytics embed if that suits your need better.

 Signature 

Andy Harris | Pepper Digital | Malvern, UK | Twitter | New to ExpressionEngine? Start here!
Remember - If at first you don’t succeed, you’re not Chuck Norris

Profile
 
 
Posted: 08 May 2008 03:00 AM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5658
Joined  04-15-2006

Yep as serafico has said the Google Analytics code is meant to go just before the closing </body> tag so if you make a footer template and just have

<!-- SOF - Google Analytics Code -->
Your Google Analytics code goes here
<!-- EOF - Google Analytics Code -->

</
body>
</
html>

and then use an {embed=“footer”} to embed that footer template into every other one of your templates then you should be set.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (15)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 08 May 2008 06:26 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  296
Joined  01-25-2006

Further more your server will counts hits from your visits and Google Analytics will not if set up correctly. Server will also count all sorts of other oddities that GA cannot such as requests for: urls that don’t exist, images, favicons, rss feeds requests (actually GA can track these I think - but you need to set it up). So there is quite a lot.

The important thing for you though is counting haw many pages are viewed so that your Authors get the correct pay. Using GA means that you are counting page views - which is what you want as you don’t want to pay them for hits that are not page views! As GA is a third party product, disputes over how many hits each story has had should not lead to problems - if the stats were from your own server logs your authors could dispute how you interpret them or indeed if they are accurate as you have access to them, so Google Analytics is a very good idea.

You could set up Google Analytics so that each Author has a separate Analytics account - and then if they have a Gmail account you could send them stats every month so they could see what to expect in payments - if this worked with your business model.

 Signature 

“All men are equal. All men, that is, who possess umbrellas.” E.M. Forster 

Artscape and Santaballs
Chris O’Donoghue Chelsea Garden Designer
The Greenwich and District Narrow Gauge Railway Society
Croydon RFC

Profile
 
 
Posted: 08 May 2008 05:33 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  124
Joined  12-24-2007

One of the projects I work on has two stats services going, and they are remarkably close (within a few hundred page views for 50K+). While not perfect, I think GA is pretty accurate.

 Signature 

Trifecta Interactive Marketing | Austin, TX

Profile
 
 
Posted: 11 May 2008 03:49 PM   [ Ignore ]   [ # 6 ]  
Lab Assistant
RankRank
Total Posts:  102
Joined  12-26-2005

Thanks all.  I have been using embeds, but really think I’m missing some traffic.  My advertisers (Apple, Adobe, HP, etc) are all given access to my GA account as are my writers.  In addition to my server stats tracking much higher, outside traffic tools like Alexa, Trafficestimate.com which typically track much lower than reallity are showing higher than my GA numbers.

Make me think something is askew.  I’ve checked each writer page and they all have the .js script so in terms of paying my writers, they are getting what is deserved.  Just not sure the entire site is getting the traffic realization in GA as it should.

It certainly would be great if the next EE build contained a place to put in your GA code and it was automatically embedded everywhere!

I saw something on another thread where someone said he used a “shared folder”.  What was he referring to?

Profile
 
 
Posted: 11 May 2008 04:46 PM   [ Ignore ]   [ # 7 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  296
Joined  01-25-2006
coolstuffchannel - 11 May 2008 03:49 PM

It certainly would be great if the next EE build contained a place to put in your GA code and it was automatically embedded everywhere!

We already have the tools to do it. If you are not sure of embeds then you can always use a Global Variable - this way if you need to change your GA code you only need do it in one place. Global Variables link is available from the templates pages - just add a new one - call it something useful like stats (or Mi or GoogleAnalytics if you like) then add the variable onto any page

{stats}


Usually on the sites I build I have a footer embed that goes on all pages so I don’t need to use a Global Variable for this but if I had more than one footer template then I would use it.

 Signature 

“All men are equal. All men, that is, who possess umbrellas.” E.M. Forster 

Artscape and Santaballs
Chris O’Donoghue Chelsea Garden Designer
The Greenwich and District Narrow Gauge Railway Society
Croydon RFC

Profile
 
 
Posted: 11 May 2008 06:01 PM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  774
Joined  12-01-2002

I’ve noticed similar for a client site that we introduced Google Analytics on a couple months ago. Google is way lower than FunnelWeb processing of raw stats. I haven’t had time to go back through and try to figure out all the reasons why. I have Google code in header; and while the site does have different header files, they are related to domain, so technically the main site has one header, and each subsites have their own headers. 

I was planning on adjusting the code placement to see if that helped; but I’m talking massive numbers. Google may be displaying 100-150,000 hits/page views per month; and raw stats has over 3 million. And with the raw stats, we exclude staff visits by IP addresses, visits to the control panel, and certain folders, since they are only accessible by staff. It’s just weird.

My goal was to test on an easier site. One where their is a single header and footer, and low page hits, to see how Google compares; and what its excluding. Because the current site does do domain tests, if/elseif embeds, and a number of other things to insure the correct header and footer are displaying based on where a person came from and what article they are pulling. There could be a number of reasons views are excessively low in Google.

Profile
 
 
Posted: 11 May 2008 06:16 PM   [ Ignore ]   [ # 9 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5658
Joined  04-15-2006

Just as a quick note for those using Google Analytics, Google does specify that you should be placing the analytics code just before the </body> tag at the end of your page and it shouldn’t go at the top of the page.

Not sure if this is causing your problems or not though. I don’t think you can ever get an absolutely 100% true representation using any of the methods as there will always be something wrong somewhere but I have to say that GA has been pretty solidly right on the few sites I have placed it on.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (15)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 11 May 2008 07:49 PM   [ Ignore ]   [ # 10 ]  
Lab Assistant
RankRank
Total Posts:  102
Joined  12-26-2005

Yeah I do have the .js code right above the </body> tag and also tried the global variable.  I know I’m missing pages like members etc, because I have gotten in there yet.  Just can’t image the difference is that large on just those specialty templates.

So to get this straight, the folks here that are using GA on EE are getting solid results?  This is compared to what as the reference?  Webstats?

Profile
 
 
Posted: 11 May 2008 08:41 PM   [ Ignore ]   [ # 11 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  364
Joined  11-05-2002

I get accurate results compared to analog (unix stats program) and also compared to what Quantcast shows in terms of the whole site. Based on that, I think GA is pretty dang good.

 Signature 

Craig Issod, Publisher
Hearth.com - Answers to all your Burning Questions
http://www.hearth.com

Profile
 
 
Posted: 11 May 2008 09:27 PM   [ Ignore ]   [ # 12 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6027
Joined  08-04-2002

Mark…Have a site that validates strict, put the Google code at the end before </body> and it no longer does…Arrrrg.
For strict, doesn’t all javascript have to be in the head area?

Profile
 
 
Posted: 11 May 2008 11:41 PM   [ Ignore ]   [ # 13 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  296
Joined  01-25-2006

PXlated - All my sites with GA code validate to xhtml1.0 Strict. GA is not an issue.

 Signature 

“All men are equal. All men, that is, who possess umbrellas.” E.M. Forster 

Artscape and Santaballs
Chris O’Donoghue Chelsea Garden Designer
The Greenwich and District Narrow Gauge Railway Society
Croydon RFC

Profile
 
 
Posted: 12 May 2008 12:22 AM   [ Ignore ]   [ # 14 ]  
Lab Assistant
RankRank
Total Posts:  102
Joined  12-26-2005

Thanks guys.  I really appreciate the feedback and this forum in general.

Now if I can only get my solspace tags to work cross-sites with multiple site manager I’d be a happy camper!  Folks over at the solspace forums don’t respond as quickly…

Profile
 
 
Posted: 12 May 2008 03:11 AM   [ Ignore ]   [ # 15 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5658
Joined  04-15-2006
PXLated - 11 May 2008 09:27 PM

Mark…Have a site that validates strict, put the Google code at the end before </body> and it no longer does…Arrrrg.
For strict, doesn’t all javascript have to be in the head area?

As far as I know it doesn’t matter where JS goes in a document whether it be STRICT or not but Google does say that the code needs to go just before the </body> tag and I did read right when they brought out GA that if it isn’t there then results and mileage may vary.

I have also not had any problems with validation on STRICT sites when the code is at the bottom of the page.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (15)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 12 May 2008 08:25 AM   [ Ignore ]   [ # 16 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6027
Joined  08-04-2002

simoncox/mark—Hmmm, sure doesn’t here…Client supplied Google code…
—————
Google-No - Validates Fine
Google-Yes - 7 Errors, all in the Google code

Edited: Removed links as problem was solved…see posts below.

Profile
 
 
Posted: 12 May 2008 08:55 AM   [ Ignore ]   [ # 17 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5658
Joined  04-15-2006

Hi PX,

What kind of errors are they as I think you may have posted the same URL twice above wink ?

Also what does your GA code look like. This is mine and it works fine. have taken out some of the specifics although it can be viewed easily enough on the site it is on I suppose grin

<sc*ipt type="text/javasc*ipt">
var
gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
docu*ent.w*ite(unescape("<sc*ipt src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javasc*ipt'>"));
</
sc*ipt>
<
sc*ipt type="text/javasc*ipt">
var
pageTracker = _gat._getTracker("UA-XXXXXXX-1");
pageTracker._initData();
pageTracker._trackPageview();
</
sc*ipt>

Don’t know if yours is anything like that? I checked out the links above but as I said before I don’t think you have the correct URL for one of them or you have taken out the GA code so I can’t really see what is going on wink

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (15)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 12 May 2008 09:37 AM   [ Ignore ]   [ # 18 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6027
Joined  08-04-2002

Ooops - Corrected the links
—————
Looks like everything is the same as yours Mark except this… (unescape( ...in the third line.
I presume I could use yours and just change the tracker # (UA-XXXXXXX-1)
—————

Edit-Add: The errors look like this…
Line 632, Column 96: document type does not allow element “script” here.
…ics.com/ga.js’ type=‘text/javascript’
>\<\/script>” );

Profile
 
 
   
1 of 3
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 62613 Total Logged-in Users: 21
Total Topics: 77113 Total Anonymous Users: 8
Total Replies: 416390 Total Guests: 150
Total Posts: 493503    
Members ( View Memberlist )