Repository URL to install this package:
|
Version:
1.0.2 ▾
|
drupal/metatag_segment
/
metatag_segment.module
|
|---|
<?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';
}
}