I'm looking for help trying to track the affiliate ID associated with an application submitted on my wordpress site.
My application is a Zoho form imbedded in the page, so as far as I know the field inputs can't be influenced by any script on my page. The form does however collect the referring link. So I can see my application URL in my submitted form data.
http://www.example.com/apply-now/
If i could add the referral ID:
?wpam-id=1
from my affiliate link:
http://www.example.com/?wpam_id=1
as a parameter to the application page so it looked like this:
http://www.example.com/apply-now/?wpam_id=1
it could be tracked perfectly. I installed the PHP everywhere plugin: https://wordpress.org/plugins/php-everywhere/ and used some PHP in my application page to pull the ID from the cookie and show it on the page,
<?php
$aff_id = $_COOKIE['wpam_id'];
echo "affiliate ID: ". $aff_id;
?>
then tried get it into the URL with no avail using
<?php
$aff_id = $_COOKIE['wpam_id'];
$url = "ref-id?" $aff_id;
header(string: 'location: ' . $url);
?>
Is there a mistake in my code or for this to work do I need to put it into one of the other .php files instead of the page itself? If so which one?
Would it be easier to just redirect to the new URL somehow?
Thank you for your help in advance.