function commerce_google_tag_manager_send_order in Commerce Google Tag Manager 7
Callback for the rules action which creates the javascript.
Uses the $order and stores the script in the session to inject it using hook_page_build on the next page request.
Parameters
object $order: The order object
2 string references to 'commerce_google_tag_manager_send_order'
File
- ./
commerce_google_tag_manager.module, line 151 - Adds the required Javascript to the checkout completion page to allow e-commerce statistics tracking through Google Tag Manager.
Code
function commerce_google_tag_manager_send_order($order) {
// Add the javascript only when we are on the order complete page.
$script = commerce_google_tag_manager_ecommerce_js($order);
$_SESSION['commerce_google_tag_manager'] = $script;
}