So, I couldn’t find an easy way to do this anywhere and thought I’d post my solution.
Sometimes you may want to forward a parameter in the URL to another page when your visitor clicks a button. This has worked for me.
You could use this to forward tracking parameters like Infusionsoft’s contactId – That’s what I use in my example here.
You can also set it up to automatically redirect to another URL with the same parameter. The reason you may want to do this is, for instance, if you need to pixel someone on a Thank You page as a ‘Lead’ but want them to automatically redirect to a scheduling software like ScheduleOnce with their contactId in tact.
The code examples are below the video. Let me know if you got value out of this by commenting and sharing!
Header Code in ClickFunnels Page Tracking Code
<script> function getParameterByName(name, url) { if (!url) url = window.location.href; name = name.replace(/[\[\]]/g, "\\amp;");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
var newParam = getParameterByName('parameter')
var nextURL3 = ('https://www.yourdomain.com/pagepath\?parameter\=' + newParam);
</script>
Button Code
<div class="de elBTN elAlign_center elMargin0 ui-droppable de-editable" id="tmp_button-86409" data-de-type="button" data-de-editing="false" data-title="button" data-ce="false" data-trigger="none" data-animate="fade" data-delay="500" style="margin-top: 30px; outline: none; cursor: pointer; display: block;" aria-disabled="false" data-elbuttontype="1"> <a onclick="location.href=nextURL3;" class="elButton elButtonSize1 elButtonColor1 elButtonRounded elButtonPadding2 elBtnVP_10 elButtonCorner3 elBtnHP_25 elBTN_b_1 elButtonShadowN1 elButtonTxtColor1 elButtonFull" style="color: rgb(255, 255, 255); font-weight: 600; background-color: rgb(1, 116, 199); font-size: 26px;"> <span class="elButtonMain"><i class="fa_prepended fa fa-angle-double-right"></i>Button Text Goes Here<i class="fa_appended fa fa-angle-double-left"></i></span> <span class="elButtonSub"></span> </a> </div>
Button CSS Code
.jsPointer { cursor: pointer; }
Timed Automatic Redirect Code
<script> function getParameterByName(name, url) { if (!url) url = window.location.href; name = name.replace(/[\[\]]/g, "\\amp;");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
var newParam = getParameterByName('parameter')
var nextURL3 = ('https://www.yourdomain.com/pagepath\?parameter\=' + newParam);
</script><script type="text/JavaScript">
setTimeout("location.href = ('https://www.yourdomain.com/pagepath\? parameter\=' + newParam);",3000);
</script>