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

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

Paramètres

string $path: The path to check.

Return value

array Array of prefetch domains if file is from Google Ad Manager.

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

Fichier

src/Asset/JsOptimizer.php, line 81

Classe

JsOptimizer
The JavaScript Optimizer.

Namespace

Drupal\advagg\Asset

Code

private function testForGoogleAdManager($path) {
    $prefetch = [];
    if (strpos($path, '/google_service.') == FALSE) {
        return $prefetch;
    }
    // Domains in the google_service.js file.
    $prefetch[] = 'https://csi.gstatic.com';
    $prefetch[] = 'https://pubads.g.doubleclick.net';
    $prefetch[] = 'https://partner.googleadservices.com';
    $prefetch[] = 'https://securepubads.g.doubleclick.net';
    // Domains in the google_ads.js file.
    $prefetch[] = 'https://pagead2.googlesyndication.com';
    // Other domains that usually get hit.
    $prefetch[] = 'https://cm.g.doubleclick.net';
    $prefetch[] = 'https://tpc.googlesyndication.com';
    return $prefetch;
}