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.3K members online now
2.3K members online now
Ask questions about Data Studio
Guide Me
star_border
Reply

REGEXP_MATCH to parse Google Analytics "Landing Page" dimension

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I'm trying to create a calculated field that will be used as a filter in my report.  Here's the syntax I'm using:

 

CASE WHEN REGEXP_MATCH(Landing Page, '(.*//de//.*)') THEN 'German'
	 WHEN REGEXP_MATCH(Landing Page, '(.*//es//.*)') THEN 'Spanish'
	 WHEN REGEXP_MATCH(Landing Page, '(.*//fr//.*)') THEN 'French'
	 WHEN REGEXP_MATCH(Landing Page, '(.*//it//.*)') THEN 'Italian'
	 WHEN REGEXP_MATCH(Landing Page, '(.*//pt//.*)') THEN 'Portuguese'
	 WHEN REGEXP_MATCH(Landing Page, '(.*//zh//.*)') THEN 'Chinese'
	 WHEN REGEXP_MATCH(Landing Page, '(.*//ja//.*)') THEN 'Japanese'
	 ELSE 'English' END

The calculated field validates ok and I do see these values available in my filter menu.  However, when I click "Spanish", for instance, I do not get any results.  The only value that is showing data is "English", which leaves me to believe that there is a problem with my syntax.  Anyone else encounter a similar issue?  If so, what can I do to fix?

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Mark H
May 2017

Re: REGEXP_MATCH to parse Google Analytics "Landing Page" dimension

Google Employee
# 4
Google Employee

Hey Mark

 

I think the problem is the double forward slashes in the regex. You don't need to escape them (and the escape character is a backslash, not a forward slash).

 

Hope this helps!

 2017-05-01_10-55-30.png

 

 

View solution in original post

REGEXP_MATCH to parse Google Analytics "Landing Page" dimension

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

Hey Mark

Please share few landing page samples here.

REGEXP_MATCH to parse Google Analytics "Landing Page" dimension

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thanks for the reply, Vivek.  Here's a few examples of our landing page URLs:

 

/fr/resources/l?title=digital-experience-platform

/resources/l?title=user-experience

/pt/resources/l?title=digital-strategy

/zh/resources/l?title=content-management-system

Marked as Best Answer.
Solution
Accepted by topic author Mark H
May 2017

Re: REGEXP_MATCH to parse Google Analytics "Landing Page" dimension

Google Employee
# 4
Google Employee

Hey Mark

 

I think the problem is the double forward slashes in the regex. You don't need to escape them (and the escape character is a backslash, not a forward slash).

 

Hope this helps!

 2017-05-01_10-55-30.png

 

 

REGEXP_MATCH to parse Google Analytics "Landing Page" dimension

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Thanks, Rick.  That seems to have done the trick.