Periscope Embeds in Salesforce

Here's an example script for how to embed periscope dashboards in a Salesforce page - in this case, we're embedding in the Accounts page. Be sure to replace your dashboard id, API key, and include the appropriate filters. 

 

<apex:page standardController="Account"> # Salesforce apex page tag

# include any cdn / libraries
<head>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jsSHA/2.0.1/sha.js'></script>
</head>

<body>

<div id="container"/> #container to house the embed

<script>
# function to create a periscopeURL
function periscopeUrl (apiKey, data) {
var path = '/api/embedded_dashboard?data=' + escape(JSON.stringify(data));

var sha = new jsSHA('SHA-256', 'TEXT');
sha.setHMACKey(apiKey, 'TEXT');
sha.update(path);
var signature = sha.getHMAC('HEX');

// Build and return final periscope URL
var url = 'https://www.periscopedata.com' + path + '&signature=' + signature;
return url;
};

var iframe = document.createElement('iframe');

// Set final periscope URL given API key, dashboard id, and account info
iframe.src = periscopeUrl('API_KEY', {
dashboard: DASHBOARD_ID,
embed: 'v2',
filters: [{name: 'FilterNameinPeriscope', value:'{!Account.Name}'}]
});

iframe.height = 1500;
iframe.width = 500;
iframe.frameBorder=0;
var div = document.getElementById('container');
div.appendChild(iframe);
</script>
</body>

</apex:page>

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like2 Follow
  • 2 Likes
  • 1 yr agoLast active
  • 599Views