Inane Coding Go on, slap that wayward code

Piwik OpenCart Ecommerce VQmod

Piwik-logo-low-res

How & Why?

It was late 2012, and I wanted to use Piwik to track Ecommerce transactions on my OpenCart store. There was a mod for nearly every other major shopping cart but not for OpenCart. Well, I thought, there damn well should be!!

And so, the InaneCoding Piwik OpenCart Ecommerce VQmod was born!

Piwik - http://piwik.org/ - a highly successful open source web analytics platform. A serious alternative to google analytics and one which I swear by!

OpenCart - http://www.opencart.com/ - A popular and powerful choice for open source shopping cart software, and my personal favourite.

VQmod - https://code.google.com/p/vqmod/ - A brilliant modding system for php or similar files, which allows the modifications to be specified in XML files without the original files ever needing to be changed. Essential for most opencart mods (including this one!), and for good reason.

 

 What does it do?

Why, it implements Piwik Ecommerce tracking for Opencart of course!

This is the most complete Opencart Piwik module currently available and is listed on the official Piwik website as the recommended module for use with Opencart. Plus its free :)

  • Tracks regular page views.
  • Tracks Ecommerce product views (category views not yet implemented).
  • Tracks Ecommerce cart add/update/delete.
  • Tracks Ecommerce orders.
  • Tracks searches on the opencart product search.
  • OpenCart admin backend for modifying settings.
  • Option to use Piwik Proxy Hide Url script to obfuscate the URL in the javascript code.
  • Fully VQmod'ed up! Does NOT overwrite any core files.

All this adds up to allow tracking of rich metrics for things such as page views, visitors, entry/exit points, keywords, ecommerce orders, products, sales leads, conversion rates etc.

You can find out more info in the readme.txt file which accompanies the mod.

To setup only takes a few minutes and 8 boxes to fill in, then you'll have full e-commerce tracking. Here is a screenshot of the admin page for the mod:

Just a few boxes to fill in and you'll have full ecommerce tracking!

 

Where can I get it?

The latest version is v1.1 (2014-06-05) and is available from the Piwik OpenCart Ecommerce VQmod github page. Or, alternatively use the github direct download link if you're not familiar with how to navigate github.

The mod is also listed on the opencart.com extension store.

 

What if I have questions?

Please read the included readme.txt file and you will likely be able to find your answer there. If not then please get in touch.

 

Donate

I DO do this in my spare time for the good of other people - I have released this mod for free in the spirit of the Open Source community, so anything you give to support me would be most appreciated and give me that little extra push to do more features and updates for you guys :)
Please donate if you use this mod and are able to give something.

Share
Comments (43) Trackbacks (5)
  1. Looks great! I’ve been looking how to easily integrate piwik with opencart. (I almost converted to prestashop since it has a plugin for this already!) I’ll try this plugin. Thanks!

  2. It asks for “full secure url to Piwik installation” and it’s required field. Does it have to have one? Because I just installed on a regular folder.

  3. Hi Jay,
    I hope it helps you out, please let me know your feedback using http://inanecoding.co.uk/contact/ once you’ve had a chance to test. Or contribute code or issues to the github page!

    As of v0.3 the Piwik urls are not structured as I’d ideally like them (bit of a mistake when I first coded it). “full secure url to Piwik installation” is the URL used for HTTPS (secure SSL) communications to your piwik installation. Enter the same as the non-secure Piwik URL but with ‘https://’ instead of ‘http://’ (even if you don’t use https on your site). In a future version I will remove this and work it out in the code instead but for now your need to enter it.

    Kevin

  4. Great plugin!!

    Only one thing in the vqmod xml you should use:
    file name=”catalog/view/theme/*/template/common/footer.tpl”
    instead
    file name=”catalog/view/theme/default/template/common/footer.tpl”

    Thanks again for this plugin.
    H2K

  5. Hi Kevin,

    Just wanted to say a big thank you for developing this plugin! I’ll be installing it on my store ASAP – will let you know if any issues arise.

    Regards,
    Jay

  6. I get error like this in my Error Log
    2013-08-16 19:24:14 – PHP Notice: Undefined index: HTTP_REFERER in /home/akmalseh/public_html/kaoskreasimu.com/piwik/PiwikTracker.php on line 92
    2013-08-16 19:24:14 – PHP Notice: Undefined index: HTTP_ACCEPT_LANGUAGE in /home/akmalseh/public_html/kaoskreasimu.com/piwik/PiwikTracker.php on line 96

    Need help.

  7. Hi,
    I followed your instructions on how to install piwik with joomla/mijoshop/opencart and the vQmod causes problems:
    the error log says search not found
    the frontside of the page just doesn’t load articles onto the cart, nor does it let you check out.
    Once I disable your vQmod, everything works like a charm again.

    Any ideas?
    Thank you for your work so far… I really wish it could work for me too.
    Please help,

    I

  8. Hello Kevin,

    Thank you for your fast reply.

    It seems the errors were due to the modification you suggested.

    However, the checkout problem still persists: the user can add products to the cart but cannot complete the checkout process after inserting all the details.

    I can’t seem to be able to open the .rar files which the ‘vqmod cache dump’ generates, nor can i attach them to a message to send them to you.

    I appreciate your help,
    Thank you very much

    Isaia

  9. Hi,

    Do you have any plans for Piwik 2.0 compatibility?

    Thanks.

    • I didn’t know it had been released, but I see it was only today so I’m not too late to the party :)

      Yes, in short. Although at the moment I have no idea what needs changing, if anything. I had a look at the piwik release notes for 2.0 and they didn’t mention anything specific changed about the core way the API or JS is called, but I could be wrong from a first glance. Have you tested yourself? Please use the contact page and send me some info if you have. If not I will test when I am able, though it will probably be after Xmas as I do this in my spare time – unless of course I get some detailed info from someone else who has tested :) *hint* *hint* !

      Cheers
      Kevin

      • Sorry, I was being a bit of a lazy arse and just assumed it wouldn’t work with Piwik 2.0 without actually testing it properly. Looks like this isn’t the case according to bmcrec’s comment. Thanks!

  10. Hello all, I have just successfully installed v0-4 release piwik opencart ecommerc vqmod on OpenCart Version 1.5.6 with vqmod version 2.4.1 and Piwik 2.0.1. I have full site tracking including Ecommerce. All with no customizations, no adjustments, no errors. Total plug and play, Awsome!!
    Thanks so much.

  11. I just installed on my webstore and everything seems to have install o.k., yet -this is a dumb question- but how do i know it all went o.k.? .. and is working? I am already tracking all i can on my piwik main install. Where will i see the results from this, it being an extension in my store admin? Just don’t see any usage directions at all. Thanks, Rick.

    • If you already have Piwik code on your site, you would be best to remove it completely before installing this mod as it inserts its own code.

      Once installed and working you should see the ecommerce orders and product views reports populated, and abandoned carts and orders show up with little icons in the visitor log. You should also see in the source code of the webpage a _paq.push(["setEcommerceView" ... term at the bottom with product info of the currently viewed product. I can’t check your site because its currently giving a HTTP 500 error.
      Kevin

      • It’s been down since i installed this module and did not know it. I had to uninstall it and still site was down, so i found the xml file and deleted it and my site is back up. Thank goodness.

        In admin on error page it was giving this report:

        2013-12-31 17:13:49 – PHP Warning: require_once() [function.require-once]: Filename cannot be empty in /hermes/bosweb26b/b649/ipg.rykeproductscom/catalog/model/tool/piwik.php on line 46

        Don’t know what all that means, but hate i lost a day of service on my webstore. I can’t believe it did not check it after loading this extension. It just loaded up fine it seems. Glad removing the xml file got me back up and going.

        I may just leave it alone. I seen they just released the 2.0 piwik and may just wait and get that set up for know. May try this later when i have the time and can remove the other install or move it to another folder on my server. I use it to monitor my other sites i sell on, ebay, bonanza, and 7 or 8 others. Thanks for the app will see about getting it going later.

        Rick.

        • Hi,

          That error means the filename you entered in the ‘Full path to the PiwikTracker.php file’ admin setting is wrong, and implies it is empty. Go back and check that.

          Having said that this is something that I’ve seen before and causes a lot of problems so I should do something to make it fail more elegantly – I’ve made an issue for it on github and I’ll try and fix this for the next release – https://github.com/InaneCoding/Piwik-OpenCart-Ecommerce-VQMod/issues/13

          Kevin

        • PS. You’ve got the Piwik image tracker code on your pages three times somehow! You may also like to consider using the javascript code instead of the image tracker as it has more complete tracking info.

          If you want me to help you get the mod up and running just send me an email through the contact page – http://inanecoding.co.uk/contact/

        • Thanks for all the help. I think i will hold what i have for now, me with all the other tracking i have with the main piwik program. I well check that out about having it listed more than once on main page and the product pages. The java script did not work for me for some reason. Don’t know why.

          It seems to be working fine though. I guess piwik 2.0 needs to be setup all by it’s self, because it says i’m up to date when i check for new updates. I want to try that release before i do anything else.

          Thanks, Rick.

  12. Hi, inanecoding! Can, please, help. Install module and when active tracking have on frontend – “Notice: Undefined index: route in ~/catalog/model/tool/piwik.php on line 218″ in this line “if ($this->request->get['route'] == “product/search”)” – i dont undestand whats wrong?

    • Hi! Thanks for reporting, I’ve had another user report this aswell. Its because I’ve used that GET variable without checking if its set.

      For now to stop the notice displaying (will still work) you can change your OC admin setting to stop these notices displaying (you should change this back once I’ve made a fix);
      Admin->System->Settings->[edit your configured store]->Server->Display Errors

      I’ve created a bug at https://github.com/InaneCoding/Piwik-OpenCart-Ecommerce-VQMod/issues/16 and will try and do a small fix soon.

      • Same error as noted above;

        Undefined index: route in catalog/model/tool/piwik.php on line 218

        New install and fresh setup.

        • Thanks, thats several people now this was a bit of an oversight obviously :) I’ll correct this for the next release. I’ll try and do this as a priority but may not be immediately as I do do this in my free time. Cheers for reporting.

  13. Piwik and opencart installed on diffrent Virtual Machine

  14. inanecoding, Thanks! Can you please help one more time:
    Whats change need do for install module if piwik installed on other PC (im use esxi – opencart and piwik on diffrent VM, and on the same LAN). Im trying Piwik installation URL: 192.168.0.211/piwik/ its right be?

    • ooo not completely sure. You need to enter the Piwik URL in the setting page, this shouldnt matter if its on a different server to the OpenCart store as long as its accessable.

      This is the URL which the visitor to the website would need to enter to go to the Piwik site. i.e. when you go to your Piwik admin panel what URL do you enter? Its probably that.

      If you’re doing a local install and thats the IP address of your machine Piwik is installed on then yes it may be correct, though can’t be sure without trying. Put it in the admin panel for the mod and see if it works!

      • I haven’t figured out how to make it work if OC and Piwik are 2 separate VPS with different IPs ect etc. Looking ad the documentation I understand this cannot be done. Can you please clarify.

        installation guide read as per below
        3. The default install assumes that Piwik is installed to the ‘/piwik/’ folder at the root of your OpenCart site.
        If you have used a custom install path then please place the ‘PiwikTracker.php’ file from ‘/upload/piwik/PiwikTracker.php’ to your custom Piwik folder.

        then in the editing page on OC you have field that takes only a full path.
        * Full path to the PiwikTracker.php file:
        Commonly this may be;
        “/home/~user/public_html/piwik/PiwikTracker.php”
        (with ‘~user’ as your hosting username).
        May vary with server configuration.

        • The piwiktracker.php file should go on the OC server, and is needed so that the code can be included.

          This is then used when making accesses to the remote Piwik server where piwik is installed.

          So just enter the Piwik URL for the Piwik server correctly in the admin settings, as well as the PiwikTracker.php filepath on the OC server, and it should all work correctly.

  15. I have installed the plugin but get this message:”File unreadable – the path entered is not a valid readable file location.” I’m pretty sure the path is correct: /domains/pinchetti.com/public_html/piwik/PiwikTracker.php (checked in directadmin and ftp) and files/paths are readable. Any suggestion please?

    • As posted on opencart.com extension store (no need to ask the question twice!);

      @Pinchecl: That error means the file is not readable! It uses the PHP ‘is_readable’ function. So, check and check again. If you really really cant get it to work I could check if the file locations entered make sense – contact me on http://inanecoding.co.uk/contact/

    • …that file path does look correct though. There’s probably some nuance to the folder structure – possibly it starts with ‘/home/’ or similar? Maybe the permissions aren’t set properly? There’s not much I can do though, you’ll have to figure out why its not accessible. Send a question to your server host perhaps?

      • Ok, thanks, I’ll keep trying to figure it out

        • Found the right absolute path by loading a pathinfo.php script. So that is solved. However, If I enable the Piwik Tracking my frontend doesn’t load, just gives an error “invalid or unsupported form of compression” while my errorlog, like some of the posts above, says “Undefined index: route in /home/koffert2/domains/pinchetti.com/public_html/catalog/model/tool/piwik.php on line 218″.

        • Glad you solved the path error.

          I think after some googling that the ‘unsupported form of compression’ error is due to the error you see in your error log, due to the PHP Notice which gets generated being accidentally inserted into the compressed HTML output (which results in part of the output being compressed and part being uncompressed, which breaks the decompression algorithm). Its explained well here, look at the second comment down; https://drupal.org/node/373101

          My next release of the mod will fix these “undefined index” errors and hopefully this should then work aswell. I will try to get this some soon but have to fit around time for other things.

          Kevin

  16. Just to say a big thank you!
    Glad I came a reading helped me get this mod up and running.

  17. Kevin, thanks for all your work on this, it is a great module. We just sent you a donation for your efforts, keep up the great work!

    We also forked this on GitHub and modified it for MijoShop, which is a Joomla extension that ports OpenCart into the Joomla CMS. Hope it helps others, you can find it here: https://github.com/SoulrSUP/Piwik-OpenCart-Ecommerce-VQMod

  18. I fell for prestashop 1.6.0.8 because it looks so good on the outside. Turns out that prestashop is heavily bloated and pages don’t load well in a browser. I am so glad I found OpenCart because it is a very fast webshop. I found many modules available for adding more functionality. Template system with direct php tags makes it totally open to design or code whatever you want. Perfect webshop for me.


Leave a comment


− seven = 1