Hello! I'm trying to map this process used on another form to get formidable to post their unique cookie values into the specified fields, with UTMs as a fallback (default direct when both are missing) -- but can't wrap my head around it. Does anyone have experience with this? Help would be greatly appreciated T_T
$url = $_COOKIE['UTMSession'];
parse_str($url, $Utmarray);
$utm_source = $utm_medium = $utm_content = $utm_campaign = $utm_term = ''; if (array_key_exists("utm_source", $Utmarray)) {
$utm_source = $Utmarray['utm_source'];
}
if (array_key_exists("utm_medium", $Utmarray)) {
$utm_medium = $Utmarray['utm_medium'];
}
if (array_key_exists("utm_content", $Utmarray)) {
$utm_content = $Utmarray['utm_content'];
}
if (array_key_exists("utm_campaign", $Utmarray)) {
$utm_campaign = $Utmarray['utm_campaign'];
}
if (array_key_exists("utm_term", $Utmarray)) {
$utm_term = $Utmarray['utm_term'];
}
// check through Url Query Parameters
if (array_key_exists("utm_source", $getQueryParams)) {
$utm_source = $getQueryParams['utm_source'];
}
if (array_key_exists("utm_medium", $getQueryParams)) {
$utm_medium = $getQueryParams['utm_medium'];
}
if (array_key_exists("utm_content", $getQueryParams)) {
$utm_content = $getQueryParams['utm_content'];
}
if (array_key_exists("utm_campaign", $getQueryParams)) {
$utm_campaign = $getQueryParams['utm_campaign'];
}
if (array_key_exists("utm_term", $getQueryParams)) {
$utm_term = $getQueryParams['utm_term'];
}
$data['Source'] = $utm_source;
$data['Medium'] = $utm_medium;
$data['Content'] = $utm_content;
$data['Campaign'] = $utm_campaign;
$data['searchTerm'] = $utm_term;
Please login or Register to submit your answer
Hi! I had to jump through some hoops to get our tracking working properly on a client site. I ended up using this page as a resource to get me started. https://github.com/scottious/google-analytics-dissection
I got it working in the end, and all data passes through to our hidden form fields, tracks perfectly, and is able to submit to SalesForce for internal tracking.
I hope it helps.
Mark
Mark this is stellar! Thank you so much!!