Howto include *.js files in own plugins


#1

Hello,

I’m developing a own Piwik plugin and I cant include a JS file. So far I made the hook in the myPlugin.php see as below:


function getListHooksRegistered()
{
	return array( 
		'AdminMenu.add' => 'addMenu',
		'AssetManager.getJsFiles' => 'getJsFiles',
	);
}

function getJsFiles($notification)
{
	$jsFiles = &$notification->getNotificationObject();
	$jsFiles[] = "plugins/myPlugin/templates/MyPlugin.js";		
}

do I have to do something else, because so far, this is not working. My *.js file is on the server and has just a console.log in it.

thanks in advance, Peter


(Matthieu Aubry) #2

It should work OK.
However you need to disable merged assets, see: http://piwik.org/participate/user-interface/#toc-asset-merging


#3

Hi Matt,

I am also facing same problem. How to disable merged assets? Please help me on this.

Thanks, Bhagat


(Matthieu Aubry) #4

in config/config.ini.php

add:

[Debug]
disable_merged_assets = 1