Add Javascript to every dashboard

Answered

Comments

5 comments

  • Avatar
    Joseph Peters

    Hi Malinda, I haven't had a chance to test this plugin yet but it looks like what you need:

    https://support.sisense.com/hc/en-us/community/posts/115000619408-Custom-Style-plugin

     

    0
    Comment actions Permalink
  • Avatar
    Malinda Jepsen

    Thanks! I'll take a look at that. I am not a UI developer, so I didn't think about putting JavaScript into a .css file.  

    0
    Comment actions Permalink
  • Avatar
    Moti Granovsky (Edited )

    Hi Malinda,

    I think you won't actually need the custom style plugin. In fact, any Sisense plugin runs in a global scope - it is executed once when the Sisense UI loads and can apply to the entire application, so code targeted at dashboards can apply to all dashboards.

    Next, to apply an operation to each dashboard that is opened by the user, you can use the global event "dashboardloaded" as is described in our developer documentation website / javascript API

    Using this event, I could for example implement a very simple plugin that reports to an external usage tracker every time a user opens a dashboard, like so:

    // registering the event handler
    prism.on("dashboardloaded", sendTrackingInfo);

    // handler implementation
    function sendTrackingInfo(dashboard){
    var payload = {
    user: prism.user.email,
    dashboardId: dashboard.oid,
    dashboardName: dashboard.title
    };
    $.post("https://myimaginarytracker.com/report/someImaginaryToken1234/", JSON.stringify(payload));
    }

    I hope this helps!

    0
    Comment actions Permalink
  • Avatar
    Malinda Jepsen

    Thanks Moti, I'll give it a shot!

    Malinda

    0
    Comment actions Permalink
  • Avatar
    Malinda Jepsen

    Moti,

    Thanks for the starter code. I was able to create my first plugin to do this!  :-)  In our case, we needed to add JavaScript code to enable a co-browsing app named SaleMove.  

     

    0
    Comment actions Permalink

Please sign in to leave a comment.