How can I get Pendo to work in my Guide/Community?


  • Jeremy Robinson

    There may be a way to tie in some JS to pull in the user's UserID value from the API or otherwise, and have it populated once logged in, but that is a bit beyond my skillset at the moment. If anyone has prior success or experience in doing this and wants to share a snippet or example of how they got it to pull in the UserID after a user logs in, that would be awesome.

  • Jeremy Robinson

    Found the best way to pass in the User ID from Zendesk to the Pendo snippet using some source code reading and regex-fu. You'll see in the snippet below, we are reading the HTML and looking for a specific link in the source code for signed in users. If users are NOT signed in, then the Pendo widget will be hidden from them.

    var code = document.getElementsByTagName("link")[3];
    var string = code.outerHTML;
    var index = string.indexOf("user_id");
    var lastIndex = string.lastIndexOf("\"");
    var id = string.slice(index+8, lastIndex);

    Once we run through these variables and get the desired format, we pass the last variable, id, into the Pendo snippet where it asks for the visitor's id value, as shown below. 

    visitor: {
    id: id // Required if user is logged in, testing Robben, Sheldon, Jonny, my test user, and my admin acct
    // email: // Optional
    // role: // Optional

    // You can add any additional visitor level key-values here,
    // as long as its not one of the above reserved names.

  • Brett Bowser
    Zendesk Community Team

    This is awesome. Thanks for sharing Jeremy!

    I'll get this added to our monthly roundup so others can take a look at this as well :)

  • Jeremy Robinson

    Thanks Brett! I hope others find it useful as well to mesh the two together.


Please sign in to leave a comment.

Powered by Zendesk