1

I've been using a free 3rd party sitestats counter for years, and I would like to get rid of the external party.

For this simple thing I'm only interested in pageviews (other stats I use google analytics for). So, I'm performing an insert on the footer of every page (excluding all bots I have seen coming along in the last week), but for some reason my counts are 45% higher than the old counter and 40% higher than google's pageview counts.

Are there any additional checks I need to do to prevent counting incorrect pageviews?

Thanks!

1
  • People who have disabled javascript won't trigger a pageview in Google analytics, but the number doing so is normally quite small, so that doesn't explain a 40% difference. Sep 22, 2011 at 14:00

2 Answers 2

1

You'll never be able to get one analytics tool to match the same numbers as another. In this case, you're comparing GA to your own system. You should be looking at trends, and not numbers.

However, 40% is quite large. I've find that anywhere from 2-10% of traffic will have JavaScript disabled depending on the industry the site is based off of. You also claim to be excluding bots - but how exactly are you determining if it is a bot or not? GA has a large list of bots, search engines, etc. that they filter out. That is most likely your largest source of difference.

Why aren't you depending more on GA for analysis instead of trying to make your own solution? If you are doing it just to grab numbers for a backend purpose, use GA's API to grab the data for graphs/whatever.

2
  • Well that simple pageview 3rd party system has data from my site back to 2001, and I want to retain that, so I copied the data to my db and would like to continue counting. I don't mind of a 10% difference anyway, but currently it's too much. Bots I determine by useragents and seeing which IP's brought a suspiciously high amount of visits in a short time (When including those I had another 50% extra visitors, and it's unlikely that by finding more bots I'll cut another 40%, as I know the biggest by now). There must be something more. Sep 23, 2011 at 7:07
  • Gotcha, that makes sense on why you'd want to keep it. What I'd suggest from here would be to start to drilldown the content. See where the biggest variants are, e.g. if there are certain pages that you're tracking a lot more than GA. If there aren't any major players in it, then try doing a little more than just pageviews - perhaps tracking visitors (via cookies or user-agent + ip hash) and comparing the numbers on that. That should help a bit on digging deeper into the problem. Side question, did you compare the previous data when the 3rd party was capturing it? How did it look? Sep 26, 2011 at 4:18
1

Ok I'm getting somewhere now...

I have added some check, so now I'm not counting a pageview when:

  • useragent contains "bot"
  • useragent contains "crawl"
  • useragent shorter than 40 chars (98% of those visits are spiders and bots it seems)
  • request_url is user registration page (seems that 99% of those requests are spambots trying to create spam account (even better would be to check IP's against bot databases, but this gets me near enough).

Result:

  • compared to google analytics (with javascript): +8% pageviews
  • compared to my old counter (with an image): +27% pageviews

I'm still evaluating, but once I get a constant difference, I'll just multiply the pageviews registered by he old counter, so here *1.27

I hope this helps people trying to make their own pageview counter.

1
  • No, you cant do that - the user agent can be set to whatever they want by bots; and most will identify themselves as common webbrowser (Mozilla, IE, Chrome) for that reason. The most reliable way would be to use some javascript like GA does it, since most bots don't execute javascript. The number of users who have JS disabled in the webbrowser is somewhere around 2% (depending on your audience) as far as i know. Sep 30, 2011 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.