You are here

function ga_stats_nid_from_url in Google Analytics Statistics 7

Same name and namespace in other branches
  1. 7.2 includes/ga.inc \ga_stats_nid_from_url()

Attempts to determine a node nid based on the provided URL.

Parameters

string $url:

Return value

int|bool

1 call to ga_stats_nid_from_url()
ga_stats_transform_data in includes/ga.inc
Transform data from the retrieved structure to one ready for Drupal storage.

File

includes/ga.inc, line 98

Code

function ga_stats_nid_from_url($url) {
  $alias = preg_replace('/^\\//', '', $url);
  if (!preg_match('/^node\\/([0-9]*)/', $alias, $matches)) {
    $alias = drupal_lookup_path('source', $alias);
  }
  if (preg_match('/^node\\/([0-9]*)/', $alias, $matches)) {
    return $matches[1];
  }
  return FALSE;
}