public static function GoogleAnalyticsEventTracking::isGaAttached in Google Analytics Event Tracking 8
Same name and namespace in other branches
- 8.2 src/GoogleAnalyticsEventTracking.php \Drupal\google_analytics_et\GoogleAnalyticsEventTracking::isGaAttached()
Evaluates whether Google Analytics itself has been attached to the page.
Parameters
$attachments:
Return value
bool
File
- src/
GoogleAnalyticsEventTracking.php, line 184
Class
Namespace
Drupal\google_analytics_etCode
public static function isGaAttached($attachments) {
if (!empty($attachments['#attached']['html_head'])) {
foreach ($attachments['#attached']['html_head'] as $attachment) {
if (!empty($attachment[1]) && $attachment[1] == 'google_analytics_tracking_script') {
return TRUE;
}
}
}
return FALSE;
}