Google Analytics: Goal setting through Regular expression

Google Analytics: Goal setting through Regular expression


Google Analytics is ubiquitous. Embedded in all most the websites to gain insights into visitor behavior. But when it comes to  advance analytics like e-commerce conversion tracking; things become complicated.

Here is a case study on How we achieved an accurate goal tracking through regular expressions embedded within URL.

Client Requirement

Client has a Opencart based jewelry portal selling various type of jewelry online including engagement rings,  earrings,  stud, pendants  and loose diamonds.

Client wanted to track individual sales and set Goals for these. Currently they had just one category of Goals set for Sales. Having aggregate Goal setting for sale was not enough for deep insights. Client wanted to separate them out e.g. Tracking exactly how many users entered through PPC ads and purchased engagement rings or what path is taken (Funnel) is taken by visitor while buying a particular items listed under Gift..


The problem faced by the client was when the product is sold out then the sale is registered under general sales, since google analytics was unable to detect sold product category. (if it is jewelry, ring  etc).


We resolved the problem by adding a “regular expression” parameter or string within the payment url by coding within the checkout process.

For example: For Engagement rings sale: /index\.php?route=(payment/bank_transfer/thankyou_page&product_type=Engagement_ring|checkout/success&product_type=Engagement_ring.

“engagement ring” expression pulled from category and pushed into the URL.

This URL is set into the Google Analytics Goal setting to register accurately sale for this category and Goal setting option maintained in GA as below.  

More Information contact Prashant Telang [email protected]