Live data from Hacker News

The Google Analytics Setup I Use on Every Site I Build

philipwalton.com

51–60 of 108 posts

Re: The Google Analytics Setup I Use on Every Site I Build

#51
post #34

Echoing what others are saying, I much prefer Google Tag Manager. Many clients use a CMS which make injecting dynamic variables into a page a bit of a pain if it's not done via rules at runtime. The Next Web has open-sourced its Google Tag Manager setup ( https://github.com/thenextweb/gtm ), which has things like Scroll Tracking, Engagement Tracking (riveted.js), Outbound Link Tracking and lots of other things that a…

Scroll Tracking, Engagement Tracking (riveted.js), Outbound Link Tracking and lots of other things that are not in the default GA setup. I understand why a site owner would want those things, but as a user it is terrifying! This is why I run an ad blocker.

Understandable - and I think people don't know enough of what Analytics solutions are doing behind the scenes for sure.

In GA's case, none of this is personally identifiable (Google actively strips info which could be PII out of listings), and the way Scroll Tracking is implemented could only ever be used in aggregate. So that is something.

Re: The Google Analytics Setup I Use on Every Site I Build

#52
post #48

Echoing what others are saying, I much prefer Google Tag Manager. Many clients use a CMS which make injecting dynamic variables into a page a bit of a pain if it's not done via rules at runtime. The Next Web has open-sourced its Google Tag Manager setup ( https://github.com/thenextweb/gtm ), which has things like Scroll Tracking, Engagement Tracking (riveted.js), Outbound Link Tracking and lots of other things that a…

Google Tag Manager is not very practical in cases where you want a secure website. It renders CSP useless because it requires all sorts of permissions like 'self' on scripts and CSS. It's good to have on the marketing webpage where no user content is displayed though.

Also worth noting--depending on your setup, GTM essentially allows arbitrary execution of JS for anyone with access to edit and publish containers.

I'm a more technically inclined marketer, but I make damn sure to check with an engineer before trying anything fancy with JS, and I make sure to test with QA.

But having stuff in GTM more or less means you have separate workflows for code outside of your existing repo. Yes you can dump a JSON export of the container and commit that, but it definitely can cause some headaches when engineers not super familiar with GTM or how it is setup have to touch things that impact it (or vice versa).

Re: The Google Analytics Setup I Use on Every Site I Build

#53

Filtering out GA sessions with the language of "C" (versus actual languages like en-us, fr, etc.) goes a long way in filtering out GA spam. This language code is 99% of the time associated with bots. I had one site where 20% of all the sessions in a given month was such fake traffic!

Isn't that a relatively easy thing for a spammer to change? Also, I'm seeing some valid traffic coming in with that language (conversions and everything).

Re: The Google Analytics Setup I Use on Every Site I Build

#54

Please don't contribute to Google's tracking dominance over the web. How insane is it that one company runs their javascript on 90% of the web?

What are the best alternatives?

https://piwik.org isn't bad, but last time I checked it was blocked in ublock origin just like GA

Re: The Google Analytics Setup I Use on Every Site I Build

#55

Please don't contribute to Google's tracking dominance over the web. How insane is it that one company runs their javascript on 90% of the web?

What are the best alternatives?

https://piwik.org seems to be the go-to open source solution.

Re: The Google Analytics Setup I Use on Every Site I Build

#56

Earlier quoted context omitted.

> a lot of bots still don't execute JavaScript I operate a service that measures this (see another comment on this discussion), and all I'll say is you'll be very surprised how many bots actually execute JS, especially stealth bots. You have to be careful either way.

> all I'll say is you'll be very surprised how many bots actually execute JS Interesting. Do you have any numbers you can share?

I don't have access to the raw log files from the customers, so can't give you a percentage. All I'll say confidently is that my service processes a lot of bot traffic that needs to be filtered out before reporting.

BTW, are you the same Peter Hartree on this Segment thread? https://community.segment.com/t/1889n1/how-common-is-client-... It would appear we've crossed paths before on this topic. Please do email me if you want to talk properly. That Segment thread has my email.

Re: The Google Analytics Setup I Use on Every Site I Build

#57
post #23

It's pretty annoying that I have to create spam filters for Google Analytics to be useful. Every site I've installed GA on has required me to filter out spam. I don't understand why something isn't done about it at an engineering level. If site owners can set up filters against spammers, is it really that hard for Google to do it? Especially since they can see it across their accounts. Seems like it's the same type o…

You can get around this with some fairly simple hacks. Write some JavaScript that evals a part of your page or something crazy like loading part of itself from Rot13 text file. Have this js generate an ID you can identify as 'real' or 'fake'. Filter your analytics by this ID. If you want to be extra funny make real and fake IDs look indistinguishable to human eyes.

99.9% of spammers are too lazy to spend any time figuring this out for a single site, and their tools won't even tell them spam isn't working. I've gotten away with adding a simple static ID to everything and except for really large juicy targets spammers don't even watse time on this.

All of my sites get zero spam with this filter

Re: The Google Analytics Setup I Use on Every Site I Build

#58

Please don't contribute to Google's tracking dominance over the web. How insane is it that one company runs their javascript on 90% of the web?

What are the best alternatives?

piwik or just grep your nginx logs.

Re: The Google Analytics Setup I Use on Every Site I Build

#59
post #23

It's pretty annoying that I have to create spam filters for Google Analytics to be useful. Every site I've installed GA on has required me to filter out spam. I don't understand why something isn't done about it at an engineering level. If site owners can set up filters against spammers, is it really that hard for Google to do it? Especially since they can see it across their accounts. Seems like it's the same type o…

Can you elaborate as to what sort of spam you are referring to? Do you mean bots viewing your pages? Or is it something else?

Re: The Google Analytics Setup I Use on Every Site I Build

#60
post #23

It's pretty annoying that I have to create spam filters for Google Analytics to be useful. Every site I've installed GA on has required me to filter out spam. I don't understand why something isn't done about it at an engineering level. If site owners can set up filters against spammers, is it really that hard for Google to do it? Especially since they can see it across their accounts. Seems like it's the same type o…

Can you elaborate as to what sort of spam you are referring to? Do you mean bots viewing your pages? Or is it something else?

He is probably talking about the infamous "vitaly referrer spam". It shows up on the referrer tab of GA dashboard with a really long domain like "merry.christmas.go.to.this.link.to.get.a.price.vitaly.com".
Post reply on HN