Set Cookie from URL Parameter and using it in HTML on a different page.
I am setting up an affiliate link area for my site and need to be able to store a URL query string into a cookie that expires in a 7 days and pull it out into HTML later down the road.
I want to pull the key 'afil' and the value 'randomvalue' and put it in a cookie in the browser.
This cookie will be used later (on another page) in a link from one of examplesite.com to order.examplesite.com but I can't keep the parameter (query string) in the URL.
I can do this on another site using PHP but HubSpot doesn't let me use PHP. I saw other posts mentioning the use of HUBL.
My PHP code is:
<body>
<?php
$value=$_GET['afil']; //the value from the url
setcookie("afilCookie", $value, strtotime( '+7 days' )); /* expire in 7 days */
?>
...
And to create a link I would then add this code to any page: