You are here

function google_adwords_path_google_adwords_path_alter in Google AdWords Conversion Tracking 7.2

Alter codes to filter for current path.

File

modules/google_adwords_path/google_adwords_path.module, line 160
Module file for the Google Adwords Path Submodule.

Code

function google_adwords_path_google_adwords_path_alter(&$codes) {
  foreach ($codes as $index => $code) {
    $page_match = FALSE;
    $paths = $code['paths'];
    $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));

    // Compare the lowercase internal and lowercase path alias (if any).
    $path_match = drupal_match_path($path, $paths);
    if ($path != $_GET['q']) {
      $path_match = $path_match || drupal_match_path($_GET['q'], $paths);
    }
    if (!$path_match) {
      unset($codes[$index]);
    }
  }
}