function googleanalytics_update_6400 in Google Analytics 6.4
Upgrade module to 6.x-4.x
File
- ./
googleanalytics.install, line 435 - Installation file for Google Analytics module.
Code
function googleanalytics_update_6400() {
$messages = array();
variable_del('googleanalytics_segmentation');
variable_del('googleanalytics_codesnippet_before_backup_6300');
variable_del('googleanalytics_codesnippet_after_backup_6300');
$messages[] = array(
'success' => TRUE,
'query' => 'Removed backup variables from pre-ga.js days.',
);
variable_del('googleanalytics_js_scope');
$messages[] = array(
'success' => TRUE,
'query' => 'Removed obsolete JavaScript scope variable.',
);
variable_del('googleanalytics_custom_var');
$messages[] = array(
'success' => TRUE,
'query' => 'Deleted obsolete custom variables. Custom variables are now custom dimensions and metrics and you need to manually configure them!',
);
// ga.js code will cause the tracker to break. Remove custom code snippets.
$googleanalytics_codesnippet_before = variable_get('googleanalytics_codesnippet_before', '');
if (!empty($googleanalytics_codesnippet_before)) {
variable_set('googleanalytics_codesnippet_before_backup_6400', $googleanalytics_codesnippet_before);
variable_del('googleanalytics_codesnippet_before');
drupal_set_message(db_prefix_tables("A backup of your previous Google Analytics code snippet (ga.js) has been saved in database table '{variable}' as 'googleanalytics_codesnippet_before_backup_6400'. You need to manually upgrade the custom 'before' code snippet to analytics.js API."), 'warning');
$messages[] = array(
'success' => TRUE,
'query' => 'Manual upgrade of custom "before" code snippet from ja.js to analytics.js API is required.',
);
}
$googleanalytics_codesnippet_after = variable_get('googleanalytics_codesnippet_after', '');
if (!empty($googleanalytics_codesnippet_after)) {
variable_set('googleanalytics_codesnippet_after_backup_6400', $googleanalytics_codesnippet_after);
variable_del('googleanalytics_codesnippet_after');
drupal_set_message(db_prefix_tables("A backup of your previous Google Analytics code snippet (ga.js) has been saved in database table '{variable}' as 'googleanalytics_codesnippet_after_backup_6400'. You need to manually upgrade the custom 'after' code snippet to analytics.js API."), 'warning');
$messages[] = array(
'success' => TRUE,
'query' => 'Manual upgrade of custom "after" code snippet from ja.js to analytics.js API is required.',
);
}
return $messages;
}