The error:
Notice: Undefined variable: data_layer in _google_tag_classes_save() (line 239 of /svn/trunk/htdocs/sites/all/modules/google_tag/includes/admin.inc).

The code that is causing the problem:

/**
 * Stores data layer classes based on current settings.
 */
function _google_tag_classes_save($realm_name = '', $realm_key = '') {
  if (module_exists('datalayer') && $data_layer == 'dataLayer') {
    // Save classes for data layer.
    // @todo How to or can we set the name of the data layer?
    // This is an open issue on datalayer project; after it is implemented in
    // datalayer then remove second condition on if block.
    _google_tag_data_layer_snippet($classes);
    if ($realm_name) {
      variable_realm_set($realm_name, $realm_key, 'google_tag_data_layer_classes', $classes);
    }
    else {
      variable_set('google_tag_data_layer_classes', $classes);
    }
  }
}

The $data_layer variable is not defined in the function scope. Not sure what the fix is here.

Comments

slydevil created an issue. See original summary.

slydevil’s picture

Issue summary: View changes
solotandem’s picture

Status: Active » Closed (duplicate)

See #2875358: Undefined $data_layer variable in _google_tag_classes_save().

Fixed in dev release. [if you disagree, then reopen or create another issue.]