function uc_googleanalytics_display in Ubercart 6.2
Same name and namespace in other branches
- 8.4 uc_googleanalytics/uc_googleanalytics.module \uc_googleanalytics_display()
- 5 uc_googleanalytics/uc_googleanalytics.module \uc_googleanalytics_display()
- 7.3 uc_googleanalytics/uc_googleanalytics.module \uc_googleanalytics_display()
Determine whether or not to display the e-commerce related JS through GA.
Return value
TRUE or FALSE indicating whether or not to display the GA e-commerce JS.
1 call to uc_googleanalytics_display()
- uc_googleanalytics_footer in uc_googleanalytics/
uc_googleanalytics.module - Implements hook_footer().
File
- uc_googleanalytics/
uc_googleanalytics.module, line 62 - Adds the required Javascript to the checkout completion page to allow e-commerce statistics tracking through Google Analytics.
Code
function uc_googleanalytics_display() {
// Display the GA e-commerce JS if the URL is cart/checkout/complete...
if (arg(0) == 'cart' && arg(1) == 'checkout' && arg(2) == 'complete') {
return TRUE;
}
// Or if the URL is the custom completion page.
$completion_page = variable_get('uc_cart_checkout_complete_page', '');
if (!empty($completion_page) && $completion_page == drupal_get_path_alias($_GET['q'])) {
return TRUE;
}
// Or if another module says this is the page through hook_ucga_display().
foreach (module_invoke_all('ucga_display') as $result) {
if ($result === TRUE) {
return TRUE;
}
}
// Otherwise return FALSE.
return FALSE;
}