You are here

public function GoogleAnalyticsAccounts::getDefaultMeasurementId in Google Analytics 4.x

1 call to GoogleAnalyticsAccounts::getDefaultMeasurementId()
GoogleAnalyticsAccounts::getAdditionalAccounts in src/Helpers/GoogleAnalyticsAccounts.php

File

src/Helpers/GoogleAnalyticsAccounts.php, line 70

Class

GoogleAnalyticsAccounts

Namespace

Drupal\google_analytics\Helpers

Code

public function getDefaultMeasurementId() {

  // The top UA- or G- Account is the default measurement ID.
  foreach ($this->accounts as $account) {
    if (preg_match(self::GOOGLE_ANALYTICS_TRACKING_MATCH, $account)) {
      return $account;
    }
  }
}