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

Data Studio
2.1K members online now
2.1K members online now
Ask questions about Data Studio
Guide Me
star_border
Reply

Extract domain from full referrer using REGEXP_EXTRACT

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hey guys,

 

I've been trying to extract a part of the full referrer to allow my user to filter conversions by referrer domain.

 

So the idea would be to create a new custom dimension within my data source, and populate it with those "referrer domains". After checking out the formula thingy, I thought the way to go would be to use regexp_extract. I currently know very little about regexp in general, and the help page states that 

 

REGEXP_EXTRACT( URL , '^https://[^/]+/([^/]+)/' )

 

should be returning "360suite" from the URL "https://support.google.com/datastudio/answer/7050487?hl=fr". So ok, I'm basically nowhere near reading the regex above, but I can tell that there's no way "360suite" will be extracted from that URL. I blame Google. (who do you expect me to blame? Myself?! Please...)

 

Sooooooo... Anyone could help me understand what's going on? Syntax, I'm learning. In the meantime, users are eager to get that domain filter they've been promised (note to self : never promise anything anymore to users.) Any regex wizard around who could help me solve the case at hand ?

 

Thanks in advance, fellow data manipulators !

 

-h