I have a goal that can be reached from two pages on my website, for example, /page1 and /page2. I've made a regular expression for the first 'Required step' of the visualization funnel:
^/(page1|page2)$
If i apply it as a filter in the Top Content report - it works fine. But there's nothing registered in the conversion funnel. I actually couldn't find any information about funnel steps - is it even possible to use regexp there just like it's done in the Goal page URL?
I've just been bitten by this. The URLs in the funnel steps are the same as the Goal Destination URL:
https://support.google.com/analytics/answer/1116091?hl=en#matchTypes states
There are three diferent match types that define how Google Analytics identifies a URL for either a goal or a funnel. The match type that you select for your goal URL also applies to the URLs in the funnel, if you create one.
So you can only have regex matches in your funnel steps, if you've chosen Regular Express in the Destination dropdown.
I had the same problem as you. I'd chosen "Equal to" in the dropdown for the destination URL but was using "Begins with" style matches in my funnel steps and therefore getting 0 entries showing in my funnel visualisation.
The following article states that the goal steps should be defined as regex as well.
http://www.analyticsmarket.com/blog/create-google-analytics-goals
"Each step should be defined as a regular expression as well."
(almost at the very bottom of the page)
Hope it helps
Try removing the first character: ^.
Related
A have a client who has an ecommerce website working on Wix. She asked me to setup the conversion funnel so she could identify when visitors leave a step, I mean, those who don't get to the order placed page. On Wix, we have 3 steps/urls, as below:
Cart: https://www.easyhomedesign.com.br/cart?appSectionParams=%7B%22origin%22%3A%22cart-popup%22%7D
Checkout: https://www.easyhomedesign.com.br/checkout?appSectionParams=%7B%22a11y%22%3Afalse%2C%22cartId%22%3A%2283476f86-4ac9-44ac-8779-4479dde12cc2%22%2C%22storeUrl%22%3A%22https%3A%2F%2Fwww.easyhomedesign.com.br%2F%22%2C%22isFastFlow%22%3Afalse%2C%22isPickupFlow%22%3Afalse%7D
and the Thank you page: https://www.easyhomedesign.com.br/thank-you-page/d28bc342-0afe-40cb-8d98-a5784b6b2f17
After each of those urls, we have dynamic string values, so I need to put into the funnel step, on the url field, those same urls but using a regex that matches to the config "starts with", since we can't know what the values on the end of the urls are and, on the funnel setup section, we don't have that combobox "Starts with". At least, that's the only solution I could think about.
Then, my idea is use something like https://www.easyhomedesign.com.br/thank-you-page/$. I don't know regex, that's only an example of what I thought about, since that part of the url is the fixed one.
Could someone help me? tks.
Although the final goal setup highly depends on your Analyitcs implementation, it is basically possible to cover such funnel with RegEx in goal funnels.
Google Analytics tracks page visits with path, buy default. So https://www.easyhomedesign.com.br/thank-you-page/d28bc342-0afe-40cb-8d98-a5784b6b2f17 will become /thank-you-page/d28bc342-0afe-40cb-8d98-a5784b6b2f17 in your reports. It can be set up to contain the domain, and the goal flow can be created as well, but it's important to check, how the RegEx should be created.
It is also important, if the above mentioned query parts are affecting the step, whether they are part of the flow or not.
Assuming that the path part is relevant, you can set up something like this.
Cart URL in reports: /cart?appSectionParams=%7B%22origin%22%3A%22cart-popup%22%7D
Cart step RegEx in goal flow: ^\/cart
^ stands for beginning of the string, but you might need to adjust, if host is present in your reports. You can also extend it to ^\/cart\?, if you expect any parameters to be present, to qualify for cart visit.
Checkout URL in reports: /checkout?appSectionParams=%7B%22a11y%22%3Afalse%2C%22cartId%22%3A%2283476f86-4ac9-44ac-8779-4479dde12cc2%22%2C%22storeUrl%22%3A%22https%3A%2F%2Fwww.easyhomedesign.com.br%2F%22%2C%22isFastFlow%22%3Afalse%2C%22isPickupFlow%22%3Afalse%7D
Checkout Cart step RegEx in goal flow: ^\/checkout
The same applies for checkout step for beginning of the string, or for any parameters required.
Thank you URL in reports: /thank-you-page/d28bc342-0afe-40cb-8d98-a5784b6b2f17
Thank you RegEx, which is essentially the goal's RegEx: ^\/thank-you-page\/[\w-]+
Here, the [\w-]+ part expects alphanumerical characters, underscore, or hyphen to be present. More precisely, one or more must exist there.
The $ sign, mentioned in the OP, could not be used here, as it indicates the end of the string, and therefore the id at the end of the URL would make it non-matching.
You will find this simple and silly Question but it is not. Please Guys help me here.
I have set of URLs in these two formats:-
https://lenskart.sg/collections/abc/products/xyz
https://lenskart.sg/collections/abc/xyz
I only need those URLs that contain the word "collections"(double quote to highlight the word) and does not contain the word "products"
How to write regex(Regular Expression) for this?
PS:- I need To filter out the URLs from Google Analytics using Regex. The Best expression I have come up till now is:- (collections/)(\w+)(/)(?!products) But Google Analytics is showing it as an Invalid Regex. It is working fine in other regex testing tool. May be Google Analytics is not accepting Negative Lookaheads. Here are Few URLs to support the same:- Google Analytics Regex - Alternative to no negative lookahead
https://www.reddit.com/r/analytics/comments/5v6q4i/regex_expression_for_does_not_contain/
https://recalll.co/?q=negative%20lookahead%20-%20Google%20Analytics%20look%20ahead&type=code
Please Guys help me here. It's a big issue for me
I do not think you need a complex regular expression at all, an include and subsequent exclude filter should suffice.
Do an include filter, select request url als filter field and "/collections/" as filter pattern. This will dismiss all Urls that do not have "/collections/" in their path (or to put it another way, this will only include Urls that match the pattern).
Then (order is important) do and exclude filter, select request url as filter field, and enter "/products" as pattern.
Filters are applied in the order they are displayed in the view settings. Each subsequent filter will work on the data a previous filter has returned. So it is often easier to split the work between multiple filters.
This is assuming that you are filtering in your view settings, but frankly if this is a filter in a report, it basically works the same way (you have to click the "advanced" link next to the filter box to access multiple filter conditions, and "Request Url" is called "Page" here, but otherwise it's basically the same).
Filters in reports do not support negative lookaheads, the (permanent) view filters allegedly do.
^\/lenskart\.sg\/collections\/abc((?!\/products).)*$
I'm not an expert, but the above RegEx will satisfy the following by matching on the first and third URLs, but not the middle.
/lenskart.sg/collections/abc/
/lenskart.sg/collections/abc/products/xyz
/lenskart.sg/collections/abc/services
I am trying to write a regular expression to be used in a Google Analytics goal that will match URLs containing
?package=whatever
and also
/success
The user will first visit a page like
www.website.com/become-client/?package=greatpackage
and if they purchase they will be lead to this page
www.website.com/become-client/?package=greatpackage/success
So based on this I could use the following regex
\?package\=greatpackage/success
This should match the correct destination and I would be able to use this in the goal settings in Analytics to create a goal for purchases of the greatpackage package.
But sometimes the website will use other parameters in addition to ?package. Like ?type, ?media and so on.
?type=business
Resulting in URLs like this
www.website.com/become-client/?package=greatpackage?type=business
and if they purchase they will be lead to this page
www.website.com/become-client/?package=greatpackage?type=business/success
Now the /success part is moved away from the ?package part. My questions is how do I write a regex that will still match this URL no matter what other parameters there may be in between the parts?
---update----
#jonarz proposed the following and it works like a charm.
\?package\=greatpackage(.*?)/success
But what if there are two products with nearly the same name. For example greatpackage and greatpackageULTRA. The code above will select both. If changing the product names is impossible, how can I then select only one of them?
The regex that would solve the problem introduced in the edit, would be:
\?package\=greatpackage((\?|\/)(.*?))?\/success(\/|\b)
Here is a test: https://regex101.com/r/jS4cH5/1 and it seems to suit your needs.
If you want to match an url like this one :
www.website.com/become-client/?package=greatpackage?type=business?other=nada/success
With a group to extract your package type :
.*\?package=([^\/?]+).*\/success
Without group (just matching the url if it's containing package=greatpackage and success)
.*\?package=greatpackage.*\/success
Without group and matching for any package type :
.*\?package=[^\/?]+.*\/success
You just need to add .* to match any char (except new lines). The [^/?]* part is there to be sure your package type isn't empty (ie : the first char isn't a / nor ?).
I am trying to create a regexp to fire a tag within Google Tag Manager on certain pages.
The issue I am having is that I do not want to fire this tag on URLs matching a querystring in them, since it is only a session identifier and I do not need the tag to fire on the pages that have a query string. These are basically duplicates and they do not need tracking in a 3rd party tracking program. I know how I could exclude them in GA, but I can't figure out how to do it for the third party tracking.
I'll detail the scenario below and what I have tried.
Example pages that come up in my URL report if I look in GA:
/page
/page/subpage?my-handsome-query-string&some-other-data
/page/subpage
/page/subpage/subsubpage
/page/?query-string-again
So what I want to do is to fire the tracking on pages that does NOT have the query string, and it is proving quite the issue.
If I put in ^/page.*[^\?] it just doesn't work. I guess I am completely using the negated character class all wrong? I can't get it working and would require some assistance on how to devise a better regexp.
Some other I tried were:
^/page/.* but this one only matched everything after /page/ but not /page.
I am not very good with regular expressions, so what I basically want to do is match /page, /page/subpage, /page/subpage/subpage etc, but not any URL that has a query string in it.
In GTM I can't create two rules that says "Include {{url path}} matching this" and "Exclude {{url path}} matching \?", so it all needs to be done within one regexp... And that totally got me at a loss.
Edit: Mike gave a good answer to solve my GTM part, but I am still interested in learning if it is possible to do above but with a single regex?
You can actually create two rules as you described.
In GTM, tags can have both Firing rules and Blocking rules. Blocking takes precedence. eg.
Firing rule:
{{url}} matches ^page/.*
Blocking rule:
{{url}} does not contain ?
Another option is to use a custom javascript macro.
It is in the form of a function(){ } which can detect a query string value in window.location.search and return boolean. Then have a firing rule {{your custom fn}} equals 1.
You can also create a macro which uses the URL macro type and Query component type.
The value is set to the query string without the leading ?. If the url was example.com?foo=bar this macro would contain foo=bar. Then simply add a firing rule {{query}} matches Regex ^$ or {{query}} does not contain something-that-will-never-be-in-the-url-to-avoid-regex
I would like to track a URL destination goal type in Google Analytics using a Regular Expression Match type.
I have a URL that is generated with a unique date that I want to setup as a goal.
Can someone help me verify what I'm doing wrong with the strings? I cannot get this to work in GA. Thank you.
Generated URL:
/products/usedleadestimator.aspx?ckSRC=030712success
Goal Tracking URL in Google Analytics W/ RegEx:
^/products/usedleadestimator\.aspx\?ckSRC=\[^/]*\success
Generated URL:
/products/newleadestimator.aspx?ckSRC=040712success
Goal Tracking URL in Google Analytics W/ RegEx:
^/products/newleadestimator\.aspx\?ckSRC=\[^/]*\success
I'm not sure how GA's 'goal tracking' works, but I believe the regular expression you're looking for is:
^/products/usedleadestimator\.aspx\?ckSRC=\d+success$
In your pattern, you had \success, which would have been interepreted as trying to match a space character followed by 'uccess'. I'm not sure why the slash was there in the first place!