Testing your regular expression Goal URLs for Google Analytics

Your dilemma: You want to create a Google Analytics Goal that defines a Goal URL using a regular expression match.  But how do you test it without having to wait 24 hours for your Google Analytics reports to be updated?


Help is at hand: Regular expressions can be tested using the search box in Google Analytics reports.  That’s right – the search box available in all reports can take and interpret regular expressions.  Let’s say that you intend to use the following regular expression as your Goal URL:


/goal_page\.html\?cid=[123][abc]-.*&.*


First, copy the regular expression into your clipboard.  Then navigate to the Content > Top Content report.  Paste the regular expression into the search box that sits below the table of data.  Now click on the “Go” button.


Do you see your Goal URL(s) in the returned report?  If yes – great, you’re good to go!  If no – you will need to spend some time refining your regular expression.  Tools like RegExr and The Regex Coach are useful for this.


There you have it – an easy way to test your regular expressions without having to wait 24 hours for your reports to update.


This method can also be used to test regular expressions for your filters.  For example, if you have a custom filter for the “Visitor Country” field that uses a regular expression, test that expression in the Visitors > Map Overlay report.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>