Sending url parameters on page load (without button/form)


#1

I need to set up a thank u page, with a script (php) that will “catch” url parameters and send a webhook with these parameters, when the page loads, without filling a form/press a button.

I know this is possible on platforms like wordpress.
Can it be done in unbounce ?

Thanks !


#2

Hi @Moty_Sahray unfortunately Unbounce doesn’t support php on the pages since it’s a backend language and Unbounce will only allow HTML, CSS, and javascript on the page. This should be possible using javascript though. You’d need a function to grab the incoming URL params (this should help get you started: https://davidwalsh.name/query-string-javascript) and then another function to send the http request (the webhook) with the parameter data.

This can be done with javascript using an AJAX request, which can be done either with vanilla JS or jQuery. I’d recommend jQuery since it’s a bit more streamlined and easier to set up https://www.w3schools.com/jquery/ajax_ajax.asp

So you’d need the function to grab the incoming params and then store those in a variable which you can include in the AJAX function to send as part of the http POST.

Hope this helps!