Use Visitor Data Variable in Guide URL

I would like to have our mobile users fill out a form on our website and I need to pass in some URL parameters in order to properly map the filled out form to a user.

How can I use Visitor data variable in the Link URL of a Guide?

example: https://www.webpage.com/form1234?userID=[visitor.id]

Thanks

1

コメント

7件のコメント
  • Hi Jeremy Blanchard

    Welcome to the Discussion Community! Unfortunately, our default HTML link buttons don't support the ability to wildcard or swap out parts of the URL, so you'll need to utilize a Custom Code block and some Javascript to pull the current URL.

    You can then build a new URL based on the current URL and use a Custom button from there pulling in the dynamic URL you've built via Javascript to redirect your customers appropriately.

    Here's a couple of articles you can reference when building out this ability:

    We do appreciate the feedback and you can subscribe and upvote this feature request:

    Hope this helps you get started!

    1
  • Thanks Howard. That sounds very promising. I look forward to trying it out as soon as we get Custom Code blocks enabled.

    Thanks again.

    1
  • No problem Jeremy Blanchard. Thanks for sharing with the Community!

    0
  • Hi Jeremy Blanchard, I just stumbled upon this post... not sure whether you were able to find the answer to your question, but this code might be helpful to you. Create a code block and include it on the Javascript tab. (One caveat: we don't recommend using this approach if your Visitor value contains PII). 

    (function (guide, step, dom) {
    var textLinkElement = dom('._pendo-text-link');

    if (!pendo._.isUndefined(textLinkElement) && !pendo._.isUndefined(pendo.visitorId)) {
    var previousUrlLink = textLinkElement[0].href;
    var newUrlLink = previousUrlLink + `?visitor=${pendo.visitorId}`;
    textLinkElement[0].href = newUrlLink;
    }

    dom('._pendo-button-primaryButton').on('click', function() {
    window.open(textLinkElement[0].href);
    pendo.onGuideDismissed();
    });

    dom(textLinkElement).on('click', function() {
    pendo.onGuideDismissed();
    });
    })(guide, step, pendo.dom);

    0
  • Hi Jeanette Fuccella - I'm trying to understand this code better. What is '._pendo-text-link' ? is that a link in a text block? I want to replace the URL on a button, and I've tried all manner of combinations but can't make it work.

    I don't understand how pendo understands the needs for dynamic page tagging, but I can't link from an announcement to a feature because our app requires a portion of the URL to be dynamic - which is metadata we are already passing to pendo!

    0
  • Thanks for the engagement but it turns out custom code blocks are NOT available on mobile guides. My original question was related to mobile users.

    0
  • Hi all, I am using the very helpful notes here. Just wondering, when building this with the helpful link here: https://stackoverflow.com/questions/20834002/building-dynamic-url-using-a-href,  I am getting my URL successfully returned but with "/undefined" before the dynamic url. I also ran the Javascript code below in my console and get undefined, as well as the html with window.location and window.location.host. Can anyone find out why that /undefined/ won't go away!? Thank you!

    <a href="javascript:window.location.host=createDynamicURL();" > test </a>


    function createDynamicURL()
    {
        //The variable to be returned
        var URL;

     //The variables containing the respective IDs
        var siteID="0bbd7dfa-01c6-41c8-b420-65758b2c467e"

    //Forming the variable to return    
      URL+=siteID;
    return URL;
    }
    1

サインインしてコメントを残してください。

お探しのものを見つけられませんでしたか?

新規投稿