Created
September 16, 2019 21:13
-
-
Save gbutt/c5f458350e93d4c6ae1555220289727d to your computer and use it in GitHub Desktop.
Pendo Configuration for Salesforce Lightning Communities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add this script to Head Markup | |
(function() { | |
// skip loading pendo for community builder pages | |
if (location.hostname.indexOf('livepreview') > -1 || location.hostname.indexOf('sitepreview') > -1) { | |
return; | |
} | |
// load pendo | |
(function(apiKey){ | |
(function(p,e,n,d,o){var v,w,x,y,z;o=p[d]=p[d]||{};o._q=[]; | |
v=['initialize','identify','updateOptions','pageLoad'];for(w=0,x=v.length;w<x;++w)(function(m){ | |
o[m]=o[m]||function(){o._q[m===v[0]?'unshift':'push']([m].concat([].slice.call(arguments,0)));};})(v[w]); | |
y=e.createElement(n);y.async=!0;y.src='https://cdn.pendo.io/agent/static/'+apiKey+'/pendo.js'; | |
z=e.getElementsByTagName(n)[0];z.parentNode.insertBefore(y,z);})(window,document,'script','pendo'); | |
})('ad4c9648-e16c-6251-f005-632138471c71'); | |
// initialize pendo | |
document.addEventListener("DOMContentLoaded", function() { | |
pendo.initialize({ | |
visitor: { | |
id: $A.get("$SObjectType").CurrentUser.Id, // Required if user is logged in | |
email: $A.get("$SObjectType").CurrentUser.Email, | |
}, | |
account: {} | |
}); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment