Monday, March 14, 2011 - 09:40
Written by

We're a small children's theatre company and make great use of Google Analytics.  We use CiviCRM/CiviEvent for our patron database and online ticket sales, and wanted to add Google Analytics ecommerce tracking to track the effectiveness of our various marketing activities.


I did this by copying /civicrm/templates/CRM/Price/Page/LineItem.tpl into a custom template directory, and adding the tracking code to my custom version.  All of our "events" use price sets, and the price options are various ticket categories (child, adult, senior, etc).  The code below tracks not only the entire order amount, but also the quantities of individual items in the order.

LineItem.tpl is called multiple times during the order/checkout process, so my custom template inserts the tracking code only when the $trxn_id variable is present -- this indicates that the order is finalized.


If you are not using price sets for your events, then you'll need to copy and modify a different template.  Probably /civicrm/templates/CRM/Event/Form/Registration/ThankYou.tpl. 


Patch available here:,19039.0.html




Really nice information with respect to eCommerce tracking. This is the most important to analyze what the visitors are doing while browsing your website? The source from where a user come to your website? Is it interesting to your content bla bla bla? These the base behind every successful business. Nowadays, lots of eCommerce websites are designed on Wordpress cms and this is the good thing because wordpress is the easiest content management as compared to others just like Magento. No doubt, magento is the best CMS for online store or an eCommerce website but this is also the fact that it is much complicated CMS. Lots of digital agencies are working on eCommerce affiliate cms projects i.e ileaddigital(.)com/services/web-design/affiliate-cms-development. Anyways, appreciative efforts that you have put to design it, thanks for it.