Same name in other branches
- 6.0.x src/Asset/JsOptimizer.php \Drupal\advagg\Asset\JsOptimizer::testForGoogleAnalytics()
- 8.x-3.x src/Asset/JsOptimizer.php \Drupal\advagg\Asset\JsOptimizer::testForGoogleAnalytics()
- 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.
Parameters
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 in src/
Asset/ JsOptimizer.php - Extract any domains to prefetch DNS.
File
-
src/
Asset/ JsOptimizer.php, line 111
Class
- JsOptimizer
- The JavaScript Optimizer.
Namespace
Drupal\advagg\AssetCode
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;
}