Change default "View Tracking Code" content

Hey Folks,

I use piwik to track 10+ some sites at work. I am also working to get various application and web service owners hooked on piwik.

The way the IT group decided to implement piwik was to have piwik.php outside the firewall and the dashboard application inside the firewall.

All the functionality works fine. The issue is that as I get more application owners using PIWIK they want the appropriate code to use.

The domain for the piwik.php outside the firewall is different than what is listed when you clik on “View Tracking Code” link in the dashboard.

So I have to copy and paste from HTML source of a working site, change the site ID for them and add rec=1 to the section. This was fine for 5 sites, but we could be ramping up to 30+ web assets so I need the users to be self sufficient.

I also want to add rec=1 by default for all new profiles.

So how do I change what content shows up in this area.

Any ideas?

Cheers

You can hack into SitesManager/API.php fonction getJavascriptTag()

to change tag being displayed on screen. To do it properly we could add a hook and you’d change the JS in a custom plugin, but manual hack can do (just remember to put the hack back after each piwik udpate)

Matt,

Thanks for the info. I will see if my IT gues can look into this.

How do we do it by the book? “Properly”?

Since I am not a formal developer I have no problem reporting a bug/feature if that is appropriate.

It might also be something to include in the Admin interface so any admin can log in and customize the code. I have already seen a few comments about people wanting to customize copy paste code to include rec=1. This requirement might facilitate them as well.

Proposed user story:
As an Admin user
I want to customize the output of “View Tracking Code” code snippet
So that I can provide clean examples to my users for their specific needs.

Implementation details

  • Admin interface dialogue
  • create hook to overide SitesManager/API.php function getJavascriptTag()