public function AmpTrackingPixel::getOutput in Analytics 8
Returns the output of the analytics service.
Return value
array A structured, renderable array.
Overrides ServicePluginBase::getOutput
File
- analytics_amp/
src/ Plugin/ AnalyticsService/ AmpTrackingPixel.php, line 47
Class
- AmpTrackingPixel
- Analytics service type.
Namespace
Drupal\analytics_amp\Plugin\AnalyticsServiceCode
public function getOutput() {
if (\Drupal::service('router.amp_context')
->isAmpRoute()) {
$output['analytics_' . $this
->getServiceId()] = [
'#type' => 'html_tag',
'#tag' => 'amp-pixel',
'#attributes' => [
'id' => Html::getUniqueId('analytics_' . $this
->getServiceId()),
'src' => $this->configuration['url'],
],
];
return $output;
}
}