You are here

function uc_googleanalytics_enable in Ubercart 6.2

Same name and namespace in other branches
  1. 7.3 uc_googleanalytics/uc_googleanalytics.install \uc_googleanalytics_enable()

Implements hook_enable().

File

uc_googleanalytics/uc_googleanalytics.module, line 16
Adds the required Javascript to the checkout completion page to allow e-commerce statistics tracking through Google Analytics.

Code

function uc_googleanalytics_enable() {

  // Get the weight of the Google Analytics module.
  $weight = db_result(db_query("SELECT weight FROM {system} WHERE name = '%s'", 'googleanalytics'));

  // Update the weight of the UC Google Analytics module so its hooks get called
  // after the actual Google Analytics module.
  db_query("UPDATE {system} SET weight = %d WHERE name = '%s'", max(1000, $weight + 1), 'uc_googleanalytics');
}