AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
2.3K members online now
2.3K members online now
Learn to identify referral spam traffic, as well as best practices to reduce referral spam in your Google Analytics account
 
Guide Me
star_border
Reply

advanced segment maximum length for regular expressions?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I'm using an advanced segment to exclude referral spam sites. There are lots of them! So I have rather long regex's to catch them.

Is there a maximum length for a regular expression in an advanced segment?

And what happens if you go over it?

Thanks.

2 Expert replyverified_user

Re: advanced segment maximum length for regular expressions?

Explorer ✭ ✭ ✭
# 2
Explorer ✭ ✭ ✭
Hi Jannette,

There is no need to re-invent the wheel as someone has already done all the work for you. You can go to https://referrerspamblocker.com/ and follow the easy steps. It uses a collaborated blacklist of known spam domains and blocks them all.

You can also read https://plus.google.com/+StephaneHamel-immeria/posts/WXdZAEe9Qb5

Lastly, you may want to apply a hostname filter to get rid of other hostname ghosts

Re: advanced segment maximum length for regular expressions?

Top Contributor
# 3
Top Contributor
Hi Jannette,

"Regular expression statements are not limited, though the total combined for a segment with multiple statements must not exceed 30,000 characters."

https://brianclifton.com/blog/2009/12/09/how-to-choose-between-advanced-segments-versus-profile-filt...

Hope this helps..

Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: advanced segment maximum length for regular expressions?

Rising Star
# 4
Rising Star
Jannette,

Instead to creating a segment with all spammers as you mentioned, a better option is to create a segment that only shows traffic from your hostnames, that way you will remove most of the spam, and the expression will be less messy.

Hope it helps.
Google Analytics Rising Star | Was my response helpful? If yes, please mark it as the 'Best Answer.' Learn how here!
Analytics Consultant at Carloseo.com - Find me on Twitter | Email me