Same name in other branches
  1. 5.0.x src/Asset/JsOptimizer.php \Drupal\advagg\Asset\JsOptimizer::testForGoogleAnalytics()
  2. 6.0.x src/Asset/JsOptimizer.php \Drupal\advagg\Asset\JsOptimizer::testForGoogleAnalytics()
  3. 8.x-4.x src/Asset/JsOptimizer.php \Drupal\advagg\Asset\JsOptimizer::testForGoogleAnalytics()

Test if the provided path is from Google Analytics and add DNS entries.

Paramètres

string $path: The path to check.

Return value

array Empty array or an array to prefetch if file is from Google Analytics.

1 call to JsOptimizer::testForGoogleAnalytics()
JsOptimizer::addDnsPrefetch dans src/Asset/JsOptimizer.php
Extract any domains to prefetch DNS.

Fichier

src/Asset/JsOptimizer.php, line 111

Classe

JsOptimizer
The JavaScript Optimizer.

Namespace

Drupal\advagg\Asset

Code

private function testForGoogleAnalytics($path) {
    $prefetch = [];
    if (strpos($path, 'GoogleAnalytics') == FALSE && strpos($path, 'google-analytics') == FALSE) {
        return $prefetch;
    }
    $prefetch[] = 'https://ssl.google-analytics.com';
    $prefetch[] = 'https://stats.g.doubleclick.net';
    return $prefetch;
}