Streaming live at 10am (PST)

[SOLVED] How to Passthrough Incoming URL Parameters on Any Link Click

Posting this here as I don’t think this is a webflow feature. Also don’t think I need my preview or live link to accomplish this.

Basically I just need a way to pass URL parameters through to the redirect URL. I need to be able to do this on any link on the page. Flow is, customer clicks on an ad, lands on this page with url parameters, clicks a button or link and goes to the next site that reads those parameters and offers them a deal.

I also have a form with a height and width dropdown selection that I need to be able to append.

I’m somewhat new to JS but I can probably understand anything that’s recommended. Thank you all in advance!

I found a way to do this.

First you must install jquery to your site.

Then use this code:

if (document.location.search.length) {
jQuery.extend({
getQueryParameters : function(str) {
return (str || document.location.search).replace(/(^?)/,’’).split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0];
}
});
( document ).ready(function() { // get qs vars as obj var qs = .getQueryParameters();
//loop all links
('a').each(function() { //get href var hrefParts = (this).attr(‘href’).split(’?’);
//get copy of qs obj
var docQS = qs;
//get href qs vars as obj
var aQS = .getQueryParameters(hrefParts[1]); //merge together qs objs .extend(docQS, aQS);
//create new href string
var newHref = hrefParts[0] + ‘?’ + jQuery.param(docQS);
//update link href
$(this).attr(‘href’, newHref);
});
});
}