Use document ready() event to fire data layer

This commit is contained in:
Albert Santoni 2014-06-11 13:52:42 -04:00
parent d984ec9b43
commit 994dbddac2
1 changed files with 4 additions and 2 deletions

View File

@ -453,7 +453,8 @@ class ShowbuilderController extends Zend_Controller_Action
$accountDuration = $trialDurationDays - $interval->d; $accountDuration = $trialDurationDays - $interval->d;
} }
$code = "dataLayer.push({ $code = "$( document ).ready(function() {
dataLayer.push({
'ZipCode': '" . $postcode . "', 'ZipCode': '" . $postcode . "',
'UserID': '" . $client->id . "', 'UserID': '" . $client->id . "',
'Customer': 'Customer', 'Customer': 'Customer',
@ -461,7 +462,8 @@ class ShowbuilderController extends Zend_Controller_Action
'Trial': '" . $isTrial . "', 'Trial': '" . $isTrial . "',
'Country': '" . $country . "', 'Country': '" . $country . "',
'AccountDuration': '" . strval($accountDuration) . "' 'AccountDuration': '" . strval($accountDuration) . "'
});"; });
});";
} }
catch (Exception $e) catch (Exception $e)