jbrule / piwikplugin-TrackingCodeCustomizer

Tracking Code Customizer plugin for the Piwik Web Analytics software package
GNU General Public License v3.0
1 stars 2 forks source link

Plugin not work in piwik 2.15 #1

Closed bronco0 closed 8 years ago

bronco0 commented 8 years ago

Hi,

This plugin does not support Piwik 2.15

WARNING: /home/httpd_app/datas/var/www/html/piwik/plugins/TrackingCodeCustomizer/TrackingCodeCustomizer.php(75): Notice - Undefined index: optionsBeforeTrackerUrl - Piwik 2.15.0 - Please report this message in the Piwik forums: http://forum.piwik.org (please do a search first as it might have been reported already)

Thank

bronco0 commented 8 years ago

Hi,

The plugin also does not work with version 2.14 of Piwik.

I suggest a change to make it compatible with piwik plugin 2.15. Just change the following line (64) of TrackingCodeCustomizer.php file :

public function applyTrackingCodeCustomizations ($sysparams, $parameters) { by public function applyTrackingCodeCustomizations (&$sysparams, $parameters) {

To avoid the notices on testing arrays, just change the condition of if with array_key_exists.

if($storedSettings["options"]) $storedSettings["options"] .= $sysparams["options"];

if($storedSettings["optionsBeforeTrackerUrl"]) $storedSettings["optionsBeforeTrackerUrl"] .=$sysparams["optionsBeforeTrackerUrl"];

replace by

if(array_key_exists("options", $storedSettings)) $storedSettings["options"] .= $sysparams["options"];

if(array_key_exists("optionsBeforeTrackerUrl", $storedSettings)) $storedSettings["optionsBeforeTrackerUrl"] .=$sysparams["optionsBeforeTrackerUrl"];

Finally and in anticipation of future we must change the method getListHooksRegistered by registerEvents because being depreciated.

Thanks

jbrule commented 8 years ago

Thank you bronco0. I need to get a newer copy of Piwik up and running. Right now in production I am limited to version 2.12 as my hosting environment isn't providing PHP above 5.3.3 (all that Red Hat provides on RHEL 6 and IT won't allow me to install anything outside the repository. Grr). I have PHP 5.5 on my Mac so I'll install there and hopefully have something within a week.

Again thank you.