• Piwik Ecommerce Extension for Magento

    by  • Last modified:November 16, 2014 • Piwik, Plugin • 33 Comments

    magento+piwik Piwik Ecommerce Extension for Magento

    One thing lacking from the Magento store was a Free Piwik Extension that gave you the real power of Piwik Ecommerce in your install. I am proud to announce, that today marks a change. I have released a plugin that automatically inserts the Piwik Tracking code into Magento 1.7. It automatically sets up Ecommerce tracking that you expect: product & category views, cart updates, orders, along with all standard Piwik tracking. You can get it here now! As of version 1.0.6, you also have access to your Piwik data from within Magento via an iFrame!

    To help with the installation an any questions, below is how to set it up, but trust me it’s so easy, you can do this before you finish a beer. The first step is to make sure you have installed, Piwik on your host. Make sure you set it up with your Magento Website and enable Ecommerce Tracking in the settings:

    Ecommerce Tracking Piwik Ecommerce Extension for Magento

    Once your Piwik is working,visit Magento to get the Piwik Extension for Magento. Click install to get the connection key you will need to paste in your Magento Connection Manager.

    magento connection manager1 Piwik Ecommerce Extension for Magento

    All done. Now just go back to your Magento dashboard menu, click on System >; Configuration. You will find “Piwik Analytics Control” on the left hand side. If hit a 404 page, or any issues make sure you clear your Magento cache.

    magento piwik config menu Piwik Ecommerce Extension for Magento

    Make sure you enable the extension (but it does not take to you save config). Fill in the address to your Piwik install and the site id.

    config 1024x270 Piwik Ecommerce Extension for Magento

    Your Piwik Auth Token, can be found in your Piwik Install under the API tab. Please note if more than one user will access the data, it is best practice to create a generic Piwik account, which can be shared by all users. Use this API key instead of the SuperUser Api Token.

    piwik api key 1024x353 Piwik Ecommerce Extension for Magento

    Once you have everything in place, click save config, (you’ll find it in the top right corner) and go enjoy your beer. You are now tracking your visitors and customers with Piwik. You can access your Piwik data from within Magento from “Reports” tab:

    iframe piwik Piwik Ecommerce Extension for Magento

    Below is an example of the iframe in action:

    iframe piwik backend 1024x511 Piwik Ecommerce Extension for Magento

    Remember to include the whole Piwik in an iframe, edit your config/config.ini.php in your Piwik Install and add the following line:

    [General]
    enable_framed_pages=1

    I have also created the below video to help you get through the install.

    For those code geeks, source code is available on Google and Github. If you encounter an issue, leave a message below or use the contact us form. So what are you waiting for already? Go download it here. Happy tracking!

    ******FAQ*****
    Does this work with earlier versions of Magento (i.e 1.6.x)?
    No, it does not, out of the box. This extension uses Magento’s 1.7 compliance with EU cookie tracking rules. To make it work with earlier versions, I have created the following mod. I have tested on my local dev and seems to work ,but you should try for yourself. Just unarchive the file and make sure you clear your cache. Please note, this disables the EU tracking function added in Magento 1.7 for Piwik, so you will have to make sure you comply with local laws. Updated to Extension Version 1.1.1

    I get a 404 page after I click Piwik Analytics Control?
    Make sure to clear the cache. Sometimes you have to log out and then login. It’s a Magento Cache bug beyond my control.

    Why I am not seeing any Ecommerce tracking? All my carts are abandoned!
    This plugin has been tested with Express, Standard and Pro versions of Paypal. The solution in 99.9% of cases is that you need to ensure you have the right settings in Paypal/Magento. Make sure Data Transfer is on, make sure you use the right IPN url for Magento. Ect. The only other reason the plugin would not work is customer does not click “Return to Store” after finishing their purchase.

    I get blank pages in my theme, what can I do?
    If you experience a blank page, try changing <reference name="before_body_end"> to <reference name="head"> in the layout file.

    Can I restrict access to Piwik Analytics Control?
    Yes, by using the simple role permissions in Magento backend, you can restrict access to the iframe or Piwik analytics control.

    I want you to rewrite or modify your plugin just for me ?
    I always appreciate user input, but to rewrite or modify this plugin is not easy to do without breaking compatibility for all other users. You need to also keep in mind this extension is free. I do not make money from this module in any way. I did it for free to share with the community of Piwik users. If a request makes sense for the community (i.e to enable new Piwik functionality) I will work on it for free. However, in order to completely rewrite or modify a plugin for custom tastes takes time. I do not have an interest in doing this kind of work for free. If you are willing to pay for changes or modifications, you may use the contact form and provide more details on the project. I can then work up a quote and timeline for changes. If you do not wish to pay, you are free to modify the plugin as you see fit. It was released open source and the code is published on Github.

    About

    About The Author: Adrian has over 12 years experience in Digital Marketing and Analytics. He currently works as a Marketing Manager at Vanilla Forums, a modern forum software platform that allows clients to connect and engage their communities and customers. Adrian has extensive experience with Google and Piwik Analytics. He lives and works in Montreal.

    • Hiro Protagonist

      Adrian, first of all thank you for your effort on this and for making this extension available to the OSS community. I have installed the latest version of the extension on Magento 1.7.0.2 and everything seemedd to go ok but I don’t get any data back, neither on the “native” piwik page, nor on the embedded one in Magento Admin. Where can I look first ?

    • harryk

      Hi,
      Fisrt thanks for this extension.
      I’ve only one problem.

      I can’t see visitor detailes log.
      When I click on the link, i’ve only the message “Data Loading” but nothing happened and I stay on the first page.
      Have you got an idea??

      Thanks in advance

    • http://www.facebook.com/Fortin.Mathieu Mathieu Fortin

      Does this work with earlier versions of Magento (i.e 1.6.x)?

      Your patch is incomplete. You must also comment out the endif; matching the if statement you’re commenting out. It works great otherwise! Thanks!

      • http://www.adrianspeyer.com/ Adrian

        @facebook-544540886:disqus that for catching. I missed it on the last update.

    • alex

      I installed it and got the following error message Class ‘Mage_PiwikAnalytics_Helper_Data’ not found in /home/username/public_html/app/Mage.php on line 546
      please advise

      I am using magento version 1.7.02

    • http://twitter.com/kylefaino Kyle Faino

      Any plans to further develop this extension for compatibility with Magento Enterprise 1.12?

      • http://www.adrianspeyer.com/ Adrian

        I know there are users who have deployed in Enterprise without issue. You can try for yourself in a test/dev environment. To make an enterprise version would require an enterprise license — to cover the cost of this I would have to charge for the plugin. It’s also something that does not make sense to me in terms of time as the current plugin seems to work in enterprise.

    • Caleb

      Plugin seems to be working just fine, however our system logs are filling up with this:

      Notice: Undefined offset: 0 in /var/www//app/code/community/Mage/PiwikAnalytics/Block/Piwik.php on line 148

      Seems to be one entry per page load, which makes magento’s system log grow very large, very quickly. Any Ideas? Latest Piwik, magento CE, and your mod.

      • http://www.adrianspeyer.com/ Adrian

        Are you using Piwik Magento Plugin 1.11?

        • Caleb

          Yep. Magento 1.7.0.2, Piwik 1.11.1, Piwik Magento Plugin1.1.1 (per Magento Connect Manager).

          • http://www.adrianspeyer.com/ Adrian

            Hmmm. It must be related to your category names. Not seeing an issue on this side. What site is it on? I’ll take a look.

      • Marcus

        Have you found the problem/solution for the Notice ?

        I’m seeing the same in the logs…

        Fully up-to-date Piwik installation + Extension
        Magento Enterprise 1.12

        • http://www.adrianspeyer.com/ Adrian

          this issue is related to categories. if you have no categories, the variable will be undefined. As this is unusual for a magento site to have no categories, the best bet is to modify line 148 where you mark

          $category_id = “”;

          that should work. When I have a chance I will add a fix.

    • 1Agency

      Great extention but we have a huge problem since some weeks and i dont know if the bug lies in this extention or in piwik itself.
      everytime someone is placeing something in the cart, it will be shown in piwik as abadoned cart.

      • http://www.adrianspeyer.com/ Adrian

        All carts are abandoned until they are completed purchases. One issue could be users not clicking the “back to site” in Paypal. This is how Magento will tell Piwik the order is complete. To reduce this issue I recommend you keep users on your site for payment.

    • Daniel

      Hi, thank you for your great extension.

      One question: Since a few days we do not get ecommerce-sales. I think it is because we changed to an https-url. Is this reasonable?

      Thanks a lot

      • http://www.adrianspeyer.com/ Adrian

        I am not aware of any issue with HTTPS. I would do a fake order and use Firebug to troubleshoot.

        • Daniel

          Hi, after switching back to http tracking is working again. I think it is an HTTP/HTTPS difference issue…

          • http://www.adrianspeyer.com/ Adrian

            There are many issues that can affect things in Magento. Maybe another plugin is causing a conflict. If you can provide an error message that would help. I use this on Https without issue and no other user has reported this issue. I need more details to help you troubleshoot if I cannot replicate behavior that causes issues.

    • Stefan

      Hey Thanks for the great extension.
      I have the problem that some orders dont get tracked I have the ecommerce activated but from the last 10 orders only 2 got tracked.
      Does it only track Paypal order and not other payment methods? Also shouldn’t it track the order as done once it shows the success page and not if some clicks shop further. I think most people wont click shop further but then leave the site after the order is a success.
      Thanks.

      • http://www.adrianspeyer.com/ Adrian

        It should track Paypal and any method on Magento (order, check, etc). None of the other external payment modules however. In terms of success page, I assume you mean the one on Paypal. They need to continue shopping button on the site or we have no way to confirm success. Final note, the plugin is open source and anyone can contribute to the code on GitHub ;)

    • AndrĂ© Luiz Bellafronte Kutians

      Hello! This extension is compatible with Magento CE 1.8.x anda Piwik 2.0.x?

      • http://www.adrianspeyer.com/ Adrian

        There are people using it without issue. It should work, but as always, please test first.

    • Maarten

      Hi Adrian, I get some error after install (manual and connect).

      No problems on homepage, but when go to admin > System > Configuration it gives:

      Fatal error: Class ‘PiwikMage_PiwikAnalytics_Helper_Data’ not found in /home/****/public_html/app/Mage.php on line 546

      Delete cache, login –> logout.

      Do you have a idea?

      • http://www.adrianspeyer.com/ Adrian

        Try to delete the current Piwik plugin, and install fresh. Also please make sure you are on the most recent version of Magento.

        • Maarten

          I already treid a several times. Use magento 1.7.0.2.

          • http://www.adrianspeyer.com/ Adrian

            Can you download the latest form Github? https://github.com/adriansonline/Piwik-for-Magento. And try this version. If not, you can try to downgrade to 1.11.

            • Maarten

              I now used the lastest version. I will try 1.11 where van I Fins that version?

            • http://www.adrianspeyer.com/ Adrian

              Check the release notes tab on Magento