Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
drupal/metatag_segment / metatag_segment.module
Size: Mime:
<?php

/**
 * @file
 * Functionality for Metatag Segment.
 */

/**
 * Implements hook_preprocess_html().
 */
function metatag_segment_preprocess_html(&$variables) {

  $config = \Drupal::config('metatag_segment.segment');

  // Only track for anonymous users.
  if (\Drupal::currentUser()->isAnonymous()) {

    $key = $config->get('segment.default_write_key');

    $variables['#attached']['drupalSettings']['metatag_segment']['default_write_key'] = $key;
    $variables['#attached']['library'][] = 'metatag_segment/segment';
  }
}