Question on regular expression for filters on GA
-
Hi guys, I am creating profiles on some of the countries sites in my network, and have managed to establish the filter for tracking certain url patterns, for example:
^/japan-english- is tracking all my urls in the Japan site that start by japan-english great! however, it is not tracking the japanese instance of the urls. The pattern for the latter is :
www.mysite.org/jp/japan-english
I could then modify the filter to track the jp subfolder like this:
^/jp/japan-english-
but it will then only track the urls on the /jp/ subfolder
does anyone know the regex command for tracking the two url patters as follows:
/jp/japan-english-
&
/japan-english-
thanks in advance
david
-
Hi John, thanks a lot for your reply... what I am actually after is two patterns rather than two url instances., eg:
/japan-english-* meaning all urls that follow that pattern
/en/japan-english-* meaning all urls (in English) that follow that pattern
so I have now got this on my filter pattern: /japan-english-
I hope it'll work both for the urls in English and in Japanese, I will post the results here,
cheers
david
-
The ^ character makes it so your expression only matches the beginning of the request URIs. If you remove it, all URLs with /japan-english will get picked up. That sounds like it should work for you.
If you really just want those two instances, you can include both and separate them with a | which acts as "or" in regular expressions.
There's a nice guide for using regular expressions in GA at http://www.ppchero.com/analytics-regular-expression-characters/ if you want to read more about them.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
GA Event: to use this feature visit: EVENT-TRACKING.COM
Hi guys, Two days ago our Google Analytics Event tracker began to show this Event/Label, etc. I cannot find its source. Anybody knows what is this about? Thanks for your answers. Ana
Reporting & Analytics | | anagentile1 -
GA not recording visitors PART 2
Further to my question yesterday where all data for Wednesday 31st July 2013 was not showing - the data did reappear yesterday afternoon. But today, all data for yesterday seems odd - across all my projects visitor numbers appear to be around 40% down on the norm. Sales were normal, so I wonder if this is another glitch - anyone else seeing strange stats in GA for yesterday?
Reporting & Analytics | | FDFPres0 -
Will my Google sub domain filter work
Bon Pormeriggio from cloudy hot sticky & Humid Wetherby UK 😉 I have three sub domains which are reporting all the same stat traffic. Phase 1 is complete in that sub domain tracking has been configured in the analytics code for: http://en.lewispr.be/
Reporting & Analytics | | Nightwing
http://fr.lewispr.be/
http://nl.lewispr.be/ But now i want to get traffic just from http://www.en.lewispr.be/ (Previously all three subdomains reported exactly the dame data). But its this stage I just want to double check. Ive set up a filter correcly as illustrated here:
http://i216.photobucket.com/albums/cc53/zymurgy_bucket/check-en-sub-domain-tracking_zps1b24f8af.jpg Will what ive done give me just traffic arriving at http://www.en.lewispr.be/ and not continue the problem of all three sub domains reporting exactly the same traffic?
Grazie tanto,
David0 -
Setting up Webmaster Tools correctly - naked domain DNS error and sub-domains question
I'm trying to get our domain (verdantly.com) set up correctly in Google Webmaster Tools. Currently, I have three "sites" setup: blog.verdantly.com (wordpress.com blog redirected to this subdomain) www.verdantly.com verdantly.com The subdomain blog and www show up without errors. However, the naked domain shows a DNS error. I've checked the DNS settings at the registrar and don't see any issues. So here are my questions: 1. Am I correct in setting up the naked domain AND the subdomains separately in Webmaster tools? 2. How do I track down / resolve the source of the DNS errors at the naked domain? Thanks!
Reporting & Analytics | | letsdothis0 -
Switching from synchronous to asynchronous code in GA
Morning all, I'm looking to integrate GA with Webmasters tools but to do so I need to have the new asynchronous GA code implemented into my website. Now, I'm happy to just copy and paste the new code into my site footer, but will that any effect on the data that I've already tracked? Is there any reason why this is really not a good idea? Thanks for your help,
Reporting & Analytics | | theshortstack0 -
Problem with Redirects and GA
We redirect our banner ads and our customers GA's don't register. What is a solution to help our customers see our traffic to them?
Reporting & Analytics | | KenPiech0 -
Reg Ex Question about Rewrite Rules
In this redirect rule, what does the "$1" mean? RewriteCond %{HTTP_HOST} ^(oldsiteaustin|www.oldsiteaustin) [NC] RewriteRule ^(.*)$ http://austin.newsite.com/$1 [R=301,L]
Reporting & Analytics | | SEOteamfl0 -
Segmenting traffic from referring sites in GA
Most of our traffic is from Referring sites, and in referring sites, job sites are sending most of the traffic. How can we segment traffic from job sites. There are about 40 such sites. We would like to receive a report which shows traffic excluding from these job sites.
Reporting & Analytics | | seoug_20050