How to make a badge open a link in a new tab

Hi everyone, I'm hoping someone has done this before, but I'm looking for an easy way to have a Text-based Activation Badge simply be a link that opens in a new tab. I'd like clicking on the badge to launch an invisible guide that runs some Javascript to open said link in a new tab. e.g., window.open("https://jamfnation.com",'_blank'); 

 

0

Comments

2 comments
  • I reviewed some of the items here but they didn't sound promising as a head start: https://github.com/pendo-io/snippets/tree/master/guides

    1
  • If still needed, add a custom code block and:

    • Add this code in the HTML section (replacing the your_url_here with your desired URL):
    <a id="openUrlLink" href="your_url_here" target="_blank"></a>
    
    • And this code in the javascript section:
    // Wait for Pendo to initialize
    function waitForPendo(callback) {
        if (!window.pendo) {
            setTimeout(function() { waitForPendo(callback); }, 100);
        } else {
            callback();
        }
    }

    waitForPendo(function() {
        // Get the link element
        var link = document.getElementById('openUrlLink');
        
        if (link) {
            // Programmatically click the link to open the URL
            link.click();
            
            // Add a short delay before deactivating the guide
            
            setTimeout(function() {
     pendo.onGuideDismissed()
    }, 500);
     
        }
    });
    2

Please sign in to leave a comment.

Didn't find what you were looking for?

New post