ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Google analytics with EE

May 08, 2008 12:15am

Subscribe [14]
  • #1 / May 08, 2008 12:15am

    coolstuffchannel

    114 posts

    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

  • #2 / May 08, 2008 4:46am

    serafico

    58 posts

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

  • #3 / May 08, 2008 4:58am

    Andy Harris

    958 posts

    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.

  • #4 / May 08, 2008 5:00am

    Mark Bowen

    12637 posts

    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

  • #5 / May 08, 2008 8:26am

    Simon Cox

    405 posts

    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.

  • #6 / May 08, 2008 7:33pm

    trif3cta

    148 posts

    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.

  • #7 / May 11, 2008 5:49pm

    coolstuffchannel

    114 posts

    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?

  • #8 / May 11, 2008 6:46pm

    Simon Cox

    405 posts

    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.

  • #9 / May 11, 2008 8:01pm

    allgood2

    427 posts

    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.

  • #10 / May 11, 2008 8:16pm

    Mark Bowen

    12637 posts

    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

  • #11 / May 11, 2008 9:49pm

    coolstuffchannel

    114 posts

    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?

  • #12 / May 11, 2008 10:41pm

    handyman

    509 posts

    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.

  • #13 / May 11, 2008 11:27pm

    PXLated

    1800 posts

    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?

  • #14 / May 12, 2008 1:41am

    Simon Cox

    405 posts

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

  • #15 / May 12, 2008 2:22am

    coolstuffchannel

    114 posts

    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…

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases