I don’t have access to an account with sticky bars enabled, but I think they automatically pass through any URL parameters from the parent page. On the parent page, I think you could do something like:
(function(){
var parentURL = document.location.href;
var newLoc = document.createElement("a");
newLoc.href = parentURL;
newLoc.search += "&source=" + encodeURIComponent(parentURL);
history.replaceState({},null,newLoc.href);
})();
prior to loading your sticky bar. That would pass through to your sticky bar and you could choose the option to pass through URL parameters on your button. Then you’d be able to grab that from the URL of your Typeform and pass it to a hidden field.
Thats a great idea @tsprinkel !
Follow up question - how would I make sure that my code loads before the sticky bar?
Just put this code before the sticky bar embed code on the parent page.
Thanks @tsprinkel - this has been really helpful. I’m just getting stuck at one point: I am not sure how to grab the URL parameters from the Typeform and pass it to the hidden field. I realize this is more of Typeform question, so please let me know if this is not the appropriate place to ask. Thanks for all your help regardless!
Definitely a Typeform question, but it looks like their syntax to fill in hidden fields is [url]#[hidden field name]=[hidden field value]. If the pass through URL parameters option doesn’t work, you could just parse it out directly in your sticky bar and manipulate it that way. However, it might be worth testing to see if altering the code to be newLoc.hash
instead of newLoc.search
would work. I don’t know if Unbounce passes through everything or just search params.