I'm trying to exclude (in a Goal) a character in a regex in Google Analytics.
Basically, I have two pages with the following URL:
/signup/done/b
/signup/done/bp
Note that both might have UTM parameters after in some results as well
I am trying to measure only /done/b
The Regex I had was the following, but it includes both strings:
(/signup/done/plan/b)
When I changed it (and verified it in an external regex tester) I got 0 results, so the /b/ was also not included.
(/signup/done/plan/b[^p])
This regex would handle the case where the URL ends with /b or if there are query parameters:
/signup/done/b($|\?.*)
So examples of converting URLs would be:
/signup/done/b
/signup/done/b?utm_campaign=test&utm_medium=display
/signup/done/b?query=value
Examples of non-converting URLs would be:
/signup/done/bd
/signup/done/b/something
Related
I want to filter a string from the URLs in Google Analytics. This can be done using the Views > Filter > Exclude using RegEx, but I have been unable to get it to work.
An outline of how these filters are set up, can be found here, however, I can not work out how to isolate the string using RegEx. I believe it will need to be one filter per URL type.
The URLs follow this format:
/software/11F372288FA/pagename
/software/13F412C5FA/pagename/summary
/software/XIL1P0BFXCKM81/pagename2
I need to exclude this part of the URL:
/11F372288FA/
So that the URL data (e.g. Session time) is recorded against:
/software/pagename
/software/pagename/summary
/software/pagename2
I have worked out that I can isolate the string using thing following RegEx
^\/validate\/(..........)\/accounts\/summary$
It is not very elegant and would require a filter for every URL type.
Thanks for the help!
I'm not certain if this will work in your exact case but instead of using regex for this it might be easier to just create a new string from the start to the end of "software" and append everything from pagename to the end. In Java this might look something like:
String newString = oldString.substring(0, 9) + oldString.substring(oldString.indexOf("pagename"));
Take note though that this will only work if the "software" at the start is always the same length and you are actually only excluding things between "software" and "pagename".
I'm using a web crawler tool to compare two different website crawls before and after migration and need to map paginated URLs that have changed format.
e.g
Old: https://example.com/page/2/ OR: https://example.com/directory/page/16/
New: https://example.com/?page=2 OR: https://example.com/directory/?page=16
The tool has a regex replace feature for URL maping,
However, I cannot get the regex correct and the end result has an extra forward slash at the end:
https://example.com/?page=2/
What is the correct regex here to get the result I'm looking for?
Regex: /page/([0-9]+)/
Replace: /?page=$1
I need to pull out links only have just string with excluding numbers and queries in URL in Google Analytics.
so, I need this URL
www.site.com/en/rent/cairo/apartments-for-rent/
and exclude these
www.site.com/en/buy/apartment-for-sale-in-acacia-compound-new-cairo-947145/
www.site.com/en/buy/apartment-for-sale-in-acacia-compound-new-cairo-947145/?price=1000
Thank you
If each URL is on its own line, and that's the only thing on the line (not even whitespace), this simple regex will do the trick: ^[^0-9|?| ]*$
I'm trying to filter some urls using gapi.client.analytics. What I want to achive is to create a regex filter that covers a lot of options. The regex should keep only urls that have this structure:
subdomain1.domain.com/some-post/
My problem is that I have some other urls that I don't know how to exclude, like:
subdomain1.domain.com/p/code/
subdomain1.domain.com/
subdomain1.domain.com/some-author/some-name/
subdomain2.domain.com/some-post/
subdomain2.domain.com/p/code/
I tried to use: ga:hostname=#subdomain1.domain.com to get links that contain only subdomain1.
I also tried: ga:hostname=~^[^/]+/?[^/]+/?$ to get only those who have 2 / in url.
Unfortunately I coudn't manage to do what I want.
Following regex should match URLs with exact one trailing directory
^[a-zA-Z0-9_-]+\.domain\.com\/[a-zA-Z0-9_-]+\/$
or
^[a-zA-Z0-9_\-\.]+\/[a-zA-Z0-9_-]+\/$
to match every domain.
You can text google analytics regex on analyticsmarket.com
I want show only the URL's that contains "category-".
url/category-cats
url/category-elfs
url/category-dogs
The following can do the job :
^url/category-\w+/?$
But note that based on your regex engine you may need to escape the back slashe!
^url\/category-\w+\/?$