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
-
Help with GA Filters - IP Addresses
I'm having a hard time filtering out both of the IP addresses at our office. One is easy with regular expressions, but the other one does not seem to be working. Here are the two IP addresses: 2606:a000:4e2b:d500:61d9:9d4e:c539:ea86
Reporting & Analytics | | ReunionMarketing
174.99.90.148 I set up these two custom filters and neither worked for the longer IP address. 2606:a000:4e2b:d500:61d9:9d4e:c539:ea86|174.99.90.148
2606:a000:4e2b:d500:61d9:9d4e:c539:ea86|174.99.90.148 Would you please help steer me in the right direction? Thanks as always MOZ friends!0 -
Looking for a GA developer to block internal traffic and integrate with Snipcart JS API - paid
Hi There, We're looking for someone to help us setup: Blocking internal traffic using a custom dimension/query URL as described here: http://www.simoahava.com/analytics/block-internal-traffic-gtm/ Integrate Google Analytics ecommerce tracking with the Snipcart API as described here: https://snipcart.com/blog/integrating-snipcart-with-google-analytics-ecommerce-tracking Discuss Kiss Metrics and possibly integrate with Snipcart We're a small, 2 person startup so are ideally looking for a freelancer or small firm to help - Any recommendations or pointers in the right direction would be much appreciated. Cheers Ben
Reporting & Analytics | | cmscss0 -
GA visitor number inconsistencies?
Hey Mozzers Recently a client of ours undertook a paid campaign using Taboola and have a vast difference between reported clicks and visitors reported by GA. On further investigation the _utm.gif event is sent to google-analytics.com 50% of the time and stat.g.doubleclick.net the remaining 50% of the time Is this likely to be the cause of the discrepancy and if so is it possible to resolve this without removing the remarketing tag (which seems to be responsible for stats.g.doublelclick.net). Many thanks Justin
Reporting & Analytics | | JustinTaylor880 -
Subdomain tracking in GA
Hi Moz community. Wonder if you could help us out with a baffling Analytics issue. Are there any reasons why the _setDomainName() function in Google Analytics wouldn't track across subdomains correctly? We have been seeing visits to a subdomain come up as referral traffic, even after implementing the right tracking code. Would be interested to hear everyone's thoughts on this. Thanks in advance.
Reporting & Analytics | | mrdavidingram1 -
No paid conversions shown in GA Multi Channel Funnel
For some reason paid conversions are not showing in the Multi Channel Funnel and nothing shows under the adwords tab. What would be the reason?
Reporting & Analytics | | jbk3650 -
Our SEO is garbage. can someone answer a few questions for me?
I've seen our SEO drop to more or less the bottom of the barrel, and I don't have any answers yet as to why. SEOMoz is running it's crawl currently, and I have a few errors about duplicate titles and content, so I know I have some work cut out for me. But, why the sudden drop? The only change I made at the time was a change to our URL structure, but all links were 301'd to their new location. Does this still hurt SEO that terribly? Also, our robots.txt file is getting indexed and showing up as the first result at times. Very embarrassing. It's doing better than our other pages. 😞 I don't get what's happening here. Yrzu3,fkbYu
Reporting & Analytics | | stagl0 -
How to filter pages in Analytics by multiple criteria
Hello, we have several pages with the same page title. Now out of all those pages I want to pick two. Let's call them "/page1" and "/page2". For those pages I want the following information (combined for both): Avg. time on page, Bounce rate, Navigation Summary Normally I get all the information under "Content" "Pages" and by choosing the "page title" as primary dimension and clicking on the respective page title. Let's call it "page | title". Choosing the filter for 1 page works fine (I just enter "/page1" in simple filter). But how can I filter for two pages ( entering " include page ends with /page1 and include page ends with /page2" in the advance filter will show 0 results). Thanks in advance
Reporting & Analytics | | guitarslinger0 -
IP address and GA
Our company is based in Noida, and in GA, i can see few visits from New Delhi. Both these cities are nearby. ( In India ) Our hosting is in US. When a visitor comes to site, does visit is based on IP address of the user's system ? Our company has taken hosting from Noida. Does that means that visits from New Delhi are Genuine and NOT from our company ? My apologies, if i am not clear...
Reporting & Analytics | | seoug_20050