I managed to send data to a hubspot form, with the only issue that the original source it’s incorrect.
I cleared cookies, simulated a visitor coming from another website, even added tracking URL like ?utm_source=facebook&utm_medium=social&utm_campaign=xyz but every time the original source is set as Direct Traffic and Original source drill-down 1 is set to the page added in the $hs_context ( ‘pageUrl’ ) Also First page seen is set to the same URL
I expect that URL to be the URL the form is submitted on and not the Original Source.
What am I doing wrong?
Full Code
//Process a new form submission in HubSpot in order to create a new Contact.
//Need to populate these variable with values from the form.
$str_post = “firstname=” . urlencode($full_name)
. “&lastname=” . urlencode($full_name)
. “&email=” . urlencode($email_address)
. “&phone=” . urlencode($phone_number)
. “&hs_context=” . urlencode($hs_context_json); //Leave this one be
//replace the values in this URL with your portal ID and your form GUID
$endpoint = ‘removed for privacy’;
$ch = #curl_init(); #curl_setopt($ch, CURLOPT_POST, true); #curl_setopt($ch, CURLOPT_POSTFIELDS, $str_post); #curl_setopt($ch, CURLOPT_URL, $endpoint); #curl_setopt($ch, CURLOPT_HTTPHEADER, array(
‘Content-Type: application/x-www-form-urlencoded’
)); #curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); #curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = #curl_exec($ch); //Log the response from HubSpot as needed.
$status_code = #curl_getinfo($ch, CURLINFO_HTTP_CODE); //Log the response status code
$curlerror = #curl_error($ch); #curl_close($ch);
I had to replace @ with # for this topic so I can post the message (new user limitations)
@Derek_Gervais I figured it out.
I had “Limit tracking to these domains” enabled under my account and I was doing testing on a development domain, not the production website, that’s why the information wasn’t accurate.
Doing the test on production seems to work just fine.
@Derek_Gervais I figured it out.
I had “Limit tracking to these domains” enabled under my account and I was doing testing on a development domain, not the production website, that’s why the information wasn’t accurate.
Doing the test on production seems to work just fine.