UTM Google and other parameter problems

3 posts by 3 authors in: Forums > CMS Builder
Last Post: June 29, 2020   (RSS)

By moh3 - June 27, 2020

hello, if you may i noticed the UTM tags are missing mandatory parameter, you can use the following tool from Google to fill in the information

https://ga-dev-tools.appspot.com/campaign-url-builder/ 

here is an example of url: https://www.nalleyfresh.com/order.php?location=2&utm_source=email&utm_medium=email&utm_campaign=huntvalley#/restaurants/nalleyfreshhuntvalley/1063

does this load properly?

By gregThomas - June 29, 2020

Hey Everyone, 

The problem was the function whereRecordNumberInUrl(0) would retrieve the number from the request before the internal link, so for the following link:

https://www.example.com/order.php?location=2&utm_medium=email&utm_source=sharpspring&sslid=MzM3NjQxMzWzMDcwBwA&sseid=MzIwszAzMTA3NwQA&jobid=75ea5113-e600-43aa-8a68-349d0be02a9f#/restaurants/nalleyfreshhuntvalley/1063/

It would use the value 9 (the final number before the hash and after the question mark) instead of the actual correct location of 2.

I've updated the code on the order page so that if it finds a location request variable, it will use that instead of the last value in the URL. Here is the updated code:

$recordNum = (!empty($_REQUEST['location']))? intval($_REQUEST['location']) : getLastNumberInUrl();


list($locationsRecords, $locationsMetaData) = getRecords(array(
'tableName' => 'locations',
'where' => "`num` = ".$recordNum,
'loadUploads' => true,
'allowSearch' => true,
'limit' => '1',
));
$locationsRecord = @$locationsRecords[0];
if (!$locationsRecord) { dieWith404("Record not found!"); }

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com