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 ( {
getQueryParameters : function(str) {
return (str ||^?)/,’’).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);

I tried using this code in the Before body tag of my page’s custom code section but it didn’t work. Would you mind elaborating on how to implement this? Much appreciated!

1 Like

same challenge here… Customer clicks on a Google Ad, lands on a Webflow landing page with the appropriate UTM parameters after the URL. Once the person fills out the form, I want them to be redirected to a thank you page (also in Webflow) that keeps the exact same UTM parameters at the end of the URL. Any ideas?