You are here

public static function AmpAnalytics::preRenderAnalytics in Accelerated Mobile Pages (AMP) 8.3

Same name and namespace in other branches
  1. 8 src/Element/AmpAnalytics.php \Drupal\amp\Element\AmpAnalytics::preRenderAnalytics()
  2. 8.2 src/Element/AmpAnalytics.php \Drupal\amp\Element\AmpAnalytics::preRenderAnalytics()

Pre-render callback: Attaches the amp-analytics library.

File

src/Element/AmpAnalytics.php, line 43

Class

AmpAnalytics
Provides a render element for amp-analytics.

Namespace

Drupal\amp\Element

Code

public static function preRenderAnalytics($element) {
  $element['#attached']['library'][] = 'amp/amp.analytics';
  return $element;
}