tag:blogger.com,1999:blog-3580069.post2899033518255802600..comments2024-02-27T07:06:31.494-05:00Comments on Google Analytics Solutions: Regular Expression Tips and TricksNickhttp://www.blogger.com/profile/07298613952446925742noreply@blogger.comBlogger17125tag:blogger.com,1999:blog-3580069.post-10007488492037245142009-07-16T17:32:59.227-04:002009-07-16T17:32:59.227-04:00Dan,
The solution might be outside the scope of G...Dan,<br /><br />The solution might be outside the scope of Google analytics.<br /><br />What you should do is redirect all traffic from non www to the www site. for example if you type http://amazon.com u get http://www.amazon.com<br /><br />This would make GA analytics execute on the www version of the site only.<br /><br />So how to do this.<br />First you need permissions to upload files to your webserver or have your IT person do it.<br /><br />Depending on the technology of your platform, it may differ.<br /><br />On an apache server you would add this line to the .htaccess file<br /><br />RewriteEngine On<br />RewriteCond %{HTTP_HOST} ^yoursite.com<br />RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]<br /><br />If you are using microsoft IIS server look up ISAPI rewrite or 404 handler.Unknownhttps://www.blogger.com/profile/03812689019094866841noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-69074270441592730642009-07-13T00:53:25.870-04:002009-07-13T00:53:25.870-04:00Ok.. I have a test..
I have multiple domain names...Ok.. I have a test..<br /><br />I have multiple domain names using the same GA tracker.<br /><br />http://www.mysite.com.au<br />http://www.mysite.es<br /><br />Problem is, merging www. results with non www. results..<br /><br />Eg: mysite.com.au<br />and www.mysite.com.au<br />should both show as:<br />www.mysite.com.au<br /><br />so I am overriding the hostname parameter as follows:<br /><br />[^w\.]{4,4}(.)*<br />output to Constructor (Hostname):<br />www\.$A1<br /><br />but it doesn't work :(<br />I got something like:<br />www.s/index.php<br />www.u/index.php<br /><br />Any suggestions?Anonymoushttps://www.blogger.com/profile/04402070446704096304noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-30469706008716417232009-04-23T18:13:00.000-04:002009-04-23T18:13:00.000-04:00OK, thanks.OK, thanks.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3580069.post-53283854873802147292009-04-22T19:09:00.000-04:002009-04-22T19:09:00.000-04:00yea you'll have to setup exclusion or stricter inc...yea you'll have to setup exclusion or stricter inclusion rules. the issue is abab is doing what it should matching ab*.Unknownhttps://www.blogger.com/profile/03812689019094866841noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-84865040034674417832009-04-22T15:04:00.000-04:002009-04-22T15:04:00.000-04:00Sorry for not being clear. This regex '^/mydir/a[b...Sorry for not being clear. This regex '^/mydir/a[b|c]+' will match:<br /><br />/mydir/abtest1.php<br />/mydir/abtest2.php<br />/mydir/actest1.php<br />/mydir/actest2.php<br />/mydir/ababtest1.php<br />/mydir/ababtest2.php<br />/mydir/acactest1.php<br />/mydir/acactest2.php<br /><br />And not match everything that does not start with <B>ab</B> or <B>ac</B> like /mydir/sptest.php and /mydir/catest.php.<br /><br />Now what can I add to not match anything that starts with <B>abab</B> like /mydir/ababtest1.php and /mydir/ababtest2.php.<br /><br />I tried many different ways with filter tester at http://www.analyticsexperts.com/resources/google-analytics-regex-filter-tester/ and did not come up with anything that works.<br /><br />Right now, my only working solution for this was to set up a filter to exclude the <B>abab</B> then set up other filter to include the <B>ab</B> and <B>ac</B>. I'm not sure if it is good way to go.Thadhttps://www.blogger.com/profile/00690319728440128625noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-72131555905580294232009-04-21T18:07:00.000-04:002009-04-21T18:07:00.000-04:00Thad, Try
'^/mydir/a[b|c]$'
I believe + would mat...Thad, Try<br />'^/mydir/a[b|c]$'<br /><br />I believe + would match anything after ab or ac.Unknownhttps://www.blogger.com/profile/03812689019094866841noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-20305603661893158412009-04-21T18:03:00.000-04:002009-04-21T18:03:00.000-04:00Try
'^/mydir/a[b|c]$'
I believe + would match any...Try<br />'^/mydir/a[b|c]$'<br /><br />I believe + would match anything after ab or ac.Unknownhttps://www.blogger.com/profile/03812689019094866841noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-29761389264897207652009-04-21T13:55:00.000-04:002009-04-21T13:55:00.000-04:00Good tips and tricks.
Well, I use this regex '^/m...Good tips and tricks.<br /><br />Well, I use this regex '^/mydir/a[b|c]+' and it worked well as it ignored everything else in /mydir except for ab* and ac*. But, it also includes the abab* that I don't want. How do I set it to ignore abab*?<br /><br />Thanks.Thadhttps://www.blogger.com/profile/00690319728440128625noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-77105752031767465192009-04-09T11:01:00.000-04:002009-04-09T11:01:00.000-04:00Thanks Robin, that is a great example on advanced ...Thanks Robin, that is a great example on advanced filters.Unknownhttps://www.blogger.com/profile/03812689019094866841noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-15687835265701779542009-04-09T09:45:00.000-04:002009-04-09T09:45:00.000-04:00Junwong -- here is a good place to start to learn ...Junwong -- here is a good place to start to learn about $A1, etc:<BR/><BR/>http://www.lunametrics.com/blog/2007/05/04/custom-filters-for-ga-part-4-custom-advanced-filters/Unknownhttps://www.blogger.com/profile/01461838022090602296noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-87763810675877138582009-04-08T23:34:00.000-04:002009-04-08T23:34:00.000-04:00Tripston - the example in the GA documentation has...Tripston - the example in the GA documentation has an IP address that <B>doesn't need</B> a carat. This is the example:<BR/>163.212.171.123<BR/><BR/>IP addresses can never have more three digits in between each dot, and so you would never need to start it with a carat. When I wrote that part of the GA documentation, I deliberately wrote it that way so that I didn't have to confuse the reader with two concepts at the same time. So in fact, both the tips and tricks (the blog) and the help center documentation are correct. <BR/><BR/>I hope that helps.Unknownhttps://www.blogger.com/profile/01461838022090602296noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-6297197891759006792009-04-08T18:49:00.000-04:002009-04-08T18:49:00.000-04:00Tank You very much this post was very helpful and...Tank You very much this post was very helpful and not only to my Analytics but also helped me to understand RegEx and use it more often. Nice written262Mediahttps://www.blogger.com/profile/00666986733199351964noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-62078568362057018252009-04-08T11:07:00.000-04:002009-04-08T11:07:00.000-04:00"You'll find that (.*) is very helpful when you ar..."You'll find that (.*) is very helpful when you are creating custom advanced filters."<BR/>Do you have more information on how to use variables in custom advanced filters. I've only seen a few examples but didn't understand how $A1 or $B2 were being generated.Unknownhttps://www.blogger.com/profile/03812689019094866841noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-48717524554645448942009-04-08T08:27:00.000-04:002009-04-08T08:27:00.000-04:00I feel that point 4 in this article about using a ...I feel that point 4 in this article about using a caret conflicts with the official advice page here (which is linked to when adding a new filter in Analytics): <A>https://www.google.com/support/googleanalytics/bin/answer.py?answer=55582</A>. The first emboldened IP example doesn't clearly state that you should add a caret and/or dollar sign to exclude <I>only</I> that specific IP. Shouldn't this advice by more clear in the official page to avoid people getting hits from other IP combinations? I wouldn't like to think of the amount of people that are incorrectly excluding IPs.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3580069.post-50098208434405958462009-04-08T00:17:00.000-04:002009-04-08T00:17:00.000-04:00I would never have noticed had you not pointed tha...I would never have noticed had you not pointed that out. Thanks<BR/><BR/>Jack O'Sullivan<BR/><A HREF="http://www.dressshoewarehouse.com/" REL="nofollow">Men's Dress Shoes</A>Jack O'Sullivanhttps://www.blogger.com/profile/05307729253819602467noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-46143828590387679692009-04-07T21:31:00.000-04:002009-04-07T21:31:00.000-04:00Oh, good catch. You are so right:www\.mysite\.com\...Oh, good catch. You are so right:<BR/><BR/>www\.mysite\.com\?pid=123<BR/><BR/>RobbinUnknownhttps://www.blogger.com/profile/01461838022090602296noreply@blogger.comtag:blogger.com,1999:blog-3580069.post-46139854460519726442009-04-07T18:47:00.000-04:002009-04-07T18:47:00.000-04:00It is worth mentioning that your example in “BACKS...It is worth mentioning that your example in “BACKSLASH TO ESCAPE” has two more special RegEx symbols – the dots. Quite often we forget about them but they do need escaping similar to “?”.In your example, there is a (very) slight chance that “www4mysite.com?pid=123" (or similar) might actually exist.<BR/>So, back to your Tips#1 – never ending improving.<BR/><BR/>ThanksNikolai Pilafovhttps://www.blogger.com/profile/00695284688005658187noreply@blogger.com