New Piwik Javascript Tracking API - How we designed it

There are a lot of changes in Piwik 0.4. Today, I'm going to write about the release of an exciting new version of piwik.js, Piwik's JavaScript tracker. While the improvements are all under the hood, Piwik's client-side code is now a heavyweight contender to the trackers from the "Big 3" (i.e., GA, Y!A, and MS).

Inspired by Remy Damour's code contribution, planning and redevelopment of piwik.js began over 9 months ago. Over this period, we continued to maintain the legacy piwik.js while developing this new and improved version. We looked at the APIs of the "Big 3". We heard your complaints. We read your suggestions. We tackled your support requests. And after many code reviews and test cycles, we believe it's time to unleash the code.

On behalf of the Piwik community, I'd like to thank everyone who submitted bug reports, suggestions, and input that drove this rewrite.

Highlights

The new piwik.js is:

  • Object-oriented.
    Multiple trackers on the same web page is now possible. And with the exception of legacy support, the code lives entirely in the Piwik namespace.
  • Backwards compatible.
    You don't have to update the tracking code on your pages. Note: we have deprecated piwik_track(), piwik_log(), and global variables for configuration but backward compatibility will always remain.
  • XHTML-friendly.
    The code no longer modifies the DOM. Specifically, the calls to document.write() — to attach the transparent 1×1 web bug image or to detect plugins in Internet Explorer — are history.
  • Less restrictive.
    The code is more forgiving about where you insert the new tracking code in your pages. Also, custom data is now JSON stringified and no longer limited to a flat structure.
  • Industry-conforming.
    The code now tracks the click event instead of mousedown.
  • More customizable.
    Check out the API. For example, you can now define your own CSS classes for piwik_ignore, piwik_download, and piwik_link.
  • Heavily tested.
    We added automated unit tests via QUnit. The code also passes JSLint and (Microsoft's) JavaScript Leak Detector.

Documentation

You can find the updated documentation for the revamped JavaScript tracking API here:

http://piwik.org/docs/javascript-tracking/

As always, we would appreciate your feedback. Thank you for using, supporting, and promoting Piwik.


This post is from Anthon Pang (aka "vipsoft"), new rockstar developer in the Piwik team.

This entry was posted on Tuesday, June 2nd, 2009 ; category Development, Documentation ; RSS comments.

117 Responses to “New Piwik Javascript Tracking API - How we designed it”

  1. Piwik 0.4 - Piwik Says:

    [...] ADDED new piwik.js Javascript Tracking API; More information in the blog post and the Javscript Tracking documentation #355 (by Anthon) - ADDED search engine links now link to [...]

  2. Stephan Says:

    How do I catch non JS-Visitors? Are they not relevant anymore?

  3. SEO Guru Says:

    Holy Dooly now this is going to be some fun too play with.

    mmmmm the possibilities.

  4. Silvan T. Golega Says:

    "Specifically, the calls to document.write() [...] are history."
    Yippie!

  5. Hans-Peter Says:

    congratulations! great work.

  6. Poyan Says:

    Great job guys, excellent!

  7. thE_iNviNcbilE Says:

    wow… all stuff sounds great :-)

  8. Michael Says:

    Well done, amazing work!

  9. exodus Says:

    Awesome api!

  10. xhtmlcssexpert Says:

    Great work!! i like it

  11. social bookmark Says:

    wow…..i like it!!!

  12. New Piwik Javascript Tracking API – How we designed it – Piwik Says:

    [...] the original post here: New Piwik Javascript Tracking API – How we designed it – Piwik Tags: about-the-release, form-, library, release-, search-entries, the-improvements, the-one, [...]

  13. Arom Says:

    Thank you for reales New Piwik Javascript Tracking API. Well DONE

  14. Jouet Says:

    Congratulations, nice !

  15. reisekrankenversicherung Says:

    Thanks for the Tipp and helpfull inforation. BEST REGARDS from Tom, GERMANY

  16. Metall Says:

    Very good work! You are Awesome api!

  17. trauringe Says:

    hi, what a great work, very helpfull for my, greetings from Germany

  18. mawista Says:

    congratulations! great work. Thanks and have a nice day!

  19. mpu Says:

    fine post, Thanks from Kurti
    my motto: Mountains never meet, people always

  20. auslandskrankenversicherung Says:

    Thanks! great Work! Best Regards from Germany

  21. finde Says:

    Very good work!

    Thank you.

  22. autoljame Says:

    you have donne great job, just keep going, thanks

  23. namensschilder Says:

    waiting so long for teh new java script

    thank so lot
    namensschilder

  24. kuriozite Says:

    this java scrip was so cool it solved all the ideas i head…

  25. lanyards Says:

    you surprise me everytime with new scripts.
    piwik make the world better
    all wishes for future works
    lanyards

  26. news Says:

    the new api runs well, but the database is getting biger and biger. how will you fix this in the future?!

  27. Haarentfernung Says:

    Die Entwicklung von Piwik ist hervorragend. Seid ich Piwik nutze habe ich endlich den Durchblick wie ich ihn brauche.
    Danke.

  28. épices Says:

    I like your site !

  29. xtcommerce Templates Says:

    congratulations! great piece of work. Thanks for this awesome tool and have a nice day! PIWIK is great.

  30. Mephisto Schuhe Says:

    Hi Piwik Team, I use ure tool in my Shop and for me it`s the best way to track my customers. Thanks !

  31. Miyuki Delicas Says:

    ….absolute awesome api! Thanks for that cool piece of work.

  32. Henry cow Says:

    I will try it tomorrow! thank you!

  33. Ringe Shop Says:

    thanks for this great work!

  34. Handyshop Says:

    nice idea, thanks a lot, tracking with Piwik is very nice!

  35. Limited Sirket Says:

    statcounter also use piwik as its primary infrastructure and it is good choice.

  36. reggae Says:

    Very good work!

    Thank you.

  37. Sox Danışmanlık Says:

    I like the modularity feature that could be integrated with other open source softwares.

  38. Marcus Buckingham Says:

    This Api requires engineering craft. Great job.

  39. is zekasi Says:

    Good job. I'm looking forward to the new release.

  40. Mosa Says:

    If you start using it once how can you live without it.
    Love it.

  41. Drumsio Says:

    It is new to me that Statcounter uses Piwik too, but if it does it must be a good choice indeed.

  42. Marcel Says:

    Yes I agree, thanks a lot!

  43. Maxim Says:

    Piwik rocks!

  44. Faruk Adams Says:

    Very good work!

    Thank you.

  45. Marcel Gucia Says:

    I like the modularity feature that could be integrated with other open source softwares.

  46. Vesna Tornjanski Says:

    absolute awesome ap! Thanks for that cool work.

  47. Verena Bohm Says:

    Thanks for Tipps and helpfull information!

  48. Mike Says:

    super site with good information many thanks!

  49. Azoren Says:

    Thanks alot you Guys are awsome!

  50. Personalisierte Kinderbücher Says:

    Wow, thats really great. You guys rules!

  51. magnet namensschilder Says:

    adding new piwik javaschript
    its perfect work
    thanks
    from namensschilder yahoo blog

  52. Marco Menke Says:

    Thanks for your effort :) Seems like Piwik is getting better and better. I'll definitely take a look..

  53. Gojiji Says:

    Piwik just made my day! Hooray!

  54. volleyball Says:

    nice tool, but there are still some bugs whit big sqls. hope this will be fixed soon.

  55. aerobie Says:

    Very good!
    Thank you.

  56. Show Says:

    Thanks for Tipps and good information! Great job!

  57. Newcomer Bands Says:

    I love Piwik, good news that you won the award!

  58. Templates Says:

    Piwik is great, thanks for this awesome tool.

  59. Enthaarung Says:

    Piwik is a perfect tool for the webanalysis!

  60. zbv Says:

    Piwik is a great tool, thanks so much.

  61. tac Says:

    thanks so much for your great work.

  62. tom Says:

    great work, thanks so much for your assistant

  63. Truckkas Says:

    Ja Bless

  64. dashitradio Says:

    we love Piwik, one of the best tools we have ever seen. thank you so much for this great piece of software

  65. KinkyNice Says:

    Yes I agree, thanks a lot! I love Piwik

    Regards,
    KinkyNice

  66. Dauerhafte Haarentfernung Says:

    Piwik is really the best tool I've ever seen! Thank you very much for this great support.

  67. mission Says:

    thanks so much, you are the best

  68. Futurestime Uhren Says:

    Nice tool and great work. Nice to track customers. Thanks.

  69. YaaCool Says:

    Great work!! Piwik make me happy. Thanks a lot!

  70. Roman Says:

    Really great work.
    Thank you.

  71. Alex Says:

    Really great work!

    I looked for such a script and stumbled accross Pwik. Nice tracking features and very supportive. Will try to integrate Piwik into another website.

    Keep up the good work!

    regards,

  72. Suchmaschinenoptimierung Says:

    This is a great work an a nice tool. Thanks for that.

  73. Norman Says:

    Cool tool. Really like it and appreciate your work!

  74. Rechnungen online schreiben Says:

    I really needed an alternative to Google Analytics for my new projects - I am testing it right now and hope I have found what I've been looking for…

    Br,
    Andreas

  75. Rechnungen online schreiben Says:

    Just checking it out - wonderful software.

    Br,
    Andreas

  76. Alleinunterhalter Says:

    Really nice work, thanks for sharing this.
    Was really helpfull.
    Greetings, Toni

  77. Anbieter Vergleich Says:

    Thx for information. it looks good….maybe i ll try it….well done

  78. BMI berechnen Says:

    thx for this helpful post. it works

  79. Werbetechnik Says:

    thanks for the great information.
    looks really good to me

  80. Dauerhafte Haarentfernung Says:

    I will use it on my site about "dauerhafte Haarentfernung mit Laser" from now on!!!

  81. YaaCool-Bio Says:

    I´m of same opinion. Great work!

  82. Riester Rente Says:

    good work - very helpfull for my site

  83. Riester Says:

    very good work - i will use it on my site

  84. Webmasters life Says:

    wow… all stuff about Piwik sounds great, i will try it on my sites! Thanks!

  85. mokume Says:

    Great inspiration. Will consider the tip for my website.

  86. Rechnung online schreiben Says:

    Die neue API Schnittstelle ist wieder einmal eine hervorragende Sache. Leider braucht man dafür programmierkenntnisse so dass ich da an meine Grenzen stosse. Aber ich steh trotzdem voll auf Piwik.

  87. Trompeter Says:

    Naja jeder kennt ja bestimmt einen der ein bisschen programmieren kann, man hilft sich eben gegenseitig aus oder nicht? Der eine kann dies dafür der andere das, aber Piwik ist trotzdem klasse auch mit wenigen Programmier Kentnissen.

    Piwik Rockt

  88. Partyshqip Says:

    danke danke

  89. Gaspari Says:

    Really nice work, thanks for sharing this.

  90. vacuum Says:

    good work!
    i will try it on my sites! Thanks!

  91. Treppenlift Says:

    Many Thanks for this useful software!

  92. Australien Fan Says:

    Great work!!

  93. GEZ Says:

    Cool tool! Thank you.

  94. Kreditantrag ohne Schufa Says:

    We say thx ;)

  95. Ferienwohnungen Cuxhaven Says:

    I am totally happy with piwik.
    It can helps me to save a lot of time for analysing my customer for Ferienwohnungen in Cuxhaven Duhnen.

  96. Heitmann Haartransplantation Says:

    Thats very great and thank you very much! L.H.

  97. Mr. Badewanne Says:

    We appreciate it very much and say thank you! Much greetings from switzerland! Mr. Badewanne;-)

  98. Sportishqiptar Says:

    danke sehr

  99. Pozycjonowanie stron Says:

    Thanks! I'm looking forward to the new release

  100. Citizen Says:

    Cool tool. Thanks for the information and for sharing this.

  101. jimmy Says:

    Hey i am a citizen and i use Google

  102. jimmy Says:

    Lets do
    Google.com

  103. Ghostwriting Says:

    I'ts a Great work!!

  104. Mark Medlock Says:

    Really nice work, thanks for sharing this.

  105. Banques Says:

    Congratulations, very nice !
    Give thanks for sharing this¨!!!

  106. Doc Says:

    Hi, thanks for sharing, but i also have problems to catch he non-js Visitors in this site. What to do?

  107. Suchmaschinenoptimierung Says:

    Good Work! Thanks for all your support

  108. Uhrenshop Tufina Says:

    Thanks its good work! I really needed an alternative to Google Analytics.

  109. zusatzinstrumente Says:

    Very good work, i like Piwik. Keep on the great work for this project.

  110. Urban Classics Says:

    It now has similar functionnality to the Google Analytics and Yahoo Analytics, check it out! It also allows developers to pass custom JSON data to be used by plugins.
    Also, it is fully compatible with the old Javascript so you don't need to re-tag your websites…

  111. Hardware günstig kaufen Says:

    One notices in Piwik nor that it is in beta status. However, the tracking can convince on its own servers. This is due mainly to the export function and the ability to install plugins. Special USP Piwik it is to have to give the data is no longer out of the hand or to an external service like Google and still not losing a JavaScript-based tracking method to have. And all of it free of charge and in constant evolution.

  112. Epilation Says:

    Thanks for that perfect tool, I will use it!

  113. Internetscout Says:

    Thanks for the great Tool. I needed for my work.

  114. Andrew Says:

    It is good news that you won the award! I like Piwik!

  115. Dr. Fine Says:

    Thanks for that cool piece of work.

  116. John Says:

    Great application. Thank you very much!

  117. Phoenix Kitchen Remodeling Says:

    Thanks Piwik team! We are using Piwik and love the results.

Leave a Reply

Entries (RSS)