In some cases you want some script to run every time a dashboard loads, some examples can be loading js package for using it in all dashboards via API or running Google Analytics script to get usage stats
Questions like where in the globe your users are coming from and which dashboards they are using are very important for understanding what kind of analysis you really need and what is useless for others.
In this sample you will learn how to run JS when any dashboard loads.
First you will need to create a script file and put it in your Prism Web folder. For using this script you will need to extract your account ID from Google Analytics website.
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'YOUR-ACCOUNT-ID']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
Call this file ganalytics.js and put it in the resources folder of PrismWeb.
Now we need to locate the configuration file to set our script to run every time a dashbaord loads, the file can be located at PrismWeb\App_Data\Configurations\dashboard_client_code.js
Now lets edit this file and add the following line right after the <App Type="customdashboardjs"> tag:
<FileSource Path="%prismweb%\Resources\ganalytics.js"/>
Save your file and restart PrismWeb in your IIS.