Universal E-Commerce Piwik Tag


I’m attempting to design a universal piwik tag for my multiple e-commerce sites. As of right now, there seems to be a significant amount of customization/tag-modification required on each e-commerce page to get piwik e-commerce tracking firing. Wouldn’t it be nice if we had one universal tag for e-commerce, and then could simply perform a mapping exercise of a website to determine which pages get which code?

E-Commerce breaks down into cart, order, category/product views… so what if we did a IF/ELSE or Switch statement to see what page the visitor was on:

IF visitor_is_on_a_cart_page THEN output_cart_piwik_tag

Has anyone built something similar? Any ideas about how to execute this? Code samples would be appreciated.


I’m afraid yuo can’t really make it more simple than it is. The key is to refactor the code outputting the JS code in your website so you can reuse your code to output Piwik JS tags with product info etc.


Curious to know what platform you are using for the ecommerce as we support several of them already. It’s a lot easier than you think. Let me know which software you are using…