Snippets

Metadrop Javascript using JS_LIBRAY to added it before google tag script, but after dom was loaded.

Created by Eduardo Morales Alberti
/**
 * Implements hook_js_alter().
 */
function stc_utm_js_alter(&$javascript) {
  $path = drupal_get_path('module', 'stc_utm') . '/js/stc_utm.js';
  if (isset($javascript[$path])) {
    $javascript[$path]['scope'] = 'footer';
    // NOTE: Google tag manager script is added in the footer.
    // Using JS_LIBRAY to added it before google tag script, but after
    // dom was loaded.
    $javascript[$path]['group'] = JS_LIBRARY;
    $javascript[$path]['scope_lock'] = TRUE;
  }
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.