News for hackers. Stuff that matters.
Re:Stop donating your customers' data to Google Analytics by AndrewStephens on Wednesday January 22, 2020 @09:08AM (#22117621)
The headline is wrong, it should be changed to "Stop donating your customers' data to Google Analytics ... donate to another large corporation instead!"

There are much better options out there. Quite apart from the solutions listed in these comments, a better option is to reconsider whether you really need analytics at all. Maybe the answer is yes if you are a business trying to understand your customers. But not every blog and project page needs analytics.

Re:Stop donating your customers' data to Google Analytics by runninganyways on Wednesday January 22, 2020 @09:29AM (#22117786)
Or you could write the 10 lines of JavaScript that'll do what 99% of people use Google analytics for
Re:Stop donating your customers' data to Google Analytics by mateus1 on Wednesday January 22, 2020 @09:45AM (#22117913)
If you think you can replicate that with 10 lines you have no idea what Google Analytics is used for.
Re:Stop donating your customers' data to Google Analytics by anderspitman on Wednesday January 22, 2020 @10:32AM (#22118351)
I'm ashamed to admit that I use GA on my blog to essentially count page views. The other information is interesting but mostly unused (by me). I would be far better served by a tool or service handling server logs (any recommendations?). But GA is 0 friction, so it's what I picked up back in the day. I suspect there are a lot of people in this boat.
Re:Stop donating your customers' data to Google Analytics by sam_goody on Wednesday January 22, 2020 @01:04PM (#22120177)
Even for page views, 10 lines of code won't replicate GA. Try counting how many hits, and you will find that all the bots and spiders quickly make the numbers meaningless.

Of course, if that is all you are doing, you should be using Matamo or Fathom or whatever, but it is not fair to say GA could easily be replaced.

Re:Stop donating your customers' data to Google Analytics by xorcist on Wednesday January 22, 2020 @03:34PM (#22121713)
Many of the common web log analyzers are a bit long in the tooth.

I've have used GoAccess for a while now and is mostly happy with it. It's fast enough and can generate pretty good looking static html which is mostly what you want for those simple use cases.

A side effect of processing log files is that you can freely try software on historical data.

Re:Stop donating your customers' data to Google Analytics by anderspitman on Wednesday January 22, 2020 @03:38PM (#22121746)
Do you have a recommendation on log format for GoAccess? I run a lot of custom services with no nginx etc in front, so I'll have to figure out the logging myself.
Re:Stop donating your customers' data to Google Analytics by joshyi on Thursday January 23, 2020 @10:06PM (#22135042)
You can always create an issue on their github page, lots of help in there: https://github.com/allinurl/goaccess/issues
Re:Stop donating your customers' data to Google Analytics by allendoerfer on Wednesday January 22, 2020 @11:04AM (#22118674)
Matomo can also be used to analyze server logs.
Re:Stop donating your customers' data to Google Analytics by anderspitman on Wednesday January 22, 2020 @11:24AM (#22118880)
19USD/mo for 3 sites seems pretty steep, and I have 0 interest in managing my own PHP service. Is there anything cheaper in this space?
Re:Stop donating your customers' data to Google Analytics by projproj on Wednesday January 22, 2020 @12:53PM (#22120046)
Just a shot in the dark, but if you use Cloudflare already, their stats include view counts. It's also probably more accurate than relying on JS tracking tools because they can count the actual requests to your site.
Re:Stop donating your customers' data to Google Analytics by anderspitman on Wednesday January 22, 2020 @02:02PM (#22120793)
My CloudFlare stats show multiple times as many hits as GA. I'm guessing it's not handling bots/spiders or something.
Re:Stop donating your customers' data to Google Analytics by TomGullen on Wednesday January 22, 2020 @02:41PM (#22121212)
We put this down to people with JavaScript disabled or ad blockers. CF does filter bot traffic but will capture all hits as it’s tracking through network requests. For us it’s around a 35% increase in what GA reports.
Re:Stop donating your customers' data to Google Analytics by anderspitman on Wednesday January 22, 2020 @03:35PM (#22121716)
For me CF is showing 3x GA unique visitors. Though that's almost all HN traffic, so I suppose it's certainly possible that 2/3 HN users have blockers.
Re:Stop donating your customers' data to Google Analytics by freehunter on Wednesday January 22, 2020 @10:11AM (#22118149)
Those 10 lines probably depend on an npm package that relies on 100 other npm packages.
Re:Stop donating your customers' data to Google Analytics by bibobap on Wednesday January 22, 2020 @09:34AM (#22117834)
Feel free to post those lines
Re:Stop donating your customers' data to Google Analytics by quickthrower2 on Saturday January 25, 2020 @11:54PM (#22150452)
I reckon you'd need more than 9 "\n" characters to get it done.

But in seriousness the 10 lines would be just use local storage or wotnot to store a tag, then call tracker.com?tag=... on each page load. "Rest is done on the server (TM)"

Re:Stop donating your customers' data to Google Analytics by Avamander on Wednesday January 22, 2020 @10:35AM (#22118385)
This really reminds me of the infamous "you can just use FTP instead of Dropbox" comment.
Re:Stop donating your customers' data to Google Analytics by tombert on Wednesday January 22, 2020 @11:14AM (#22118780)
I don't disagree, but in a bit of fairness, a lot of people just use GA for page-counts and basic correlation stuff...you could do that in a relatively small amount of frontend JS stuff and a slightly-more-complex backend API to handle the basic correlation stuff.

That said, that will only do about .01% of all the features of GA; like the infamous "FTP vs. Dropbox" the premise itself isn't exactly "wrong", just missing a bigger point.

Re:Stop donating your customers' data to Google Analytics by MadWombat on Wednesday January 22, 2020 @12:48PM (#22119978)
Could you link me to the FTP vs. Dropbox discussion? I am curious. I haven't used either for years and the implication seems to be that there is a profound difference, so I wonder what it is.
Re:Stop donating your customers' data to Google Analytics by winthrowe on Wednesday January 22, 2020 @12:58PM (#22120111)
This is the 'infamous' original thread in question: https://news.ycombinator.com/item?id=8863
Re:Stop donating your customers' data to Google Analytics by MadWombat on Wednesday January 22, 2020 @04:55PM (#22122473)
That is cute, thank you.