You are here

function theme_google_adwords_tracking in Google AdWords Conversion Tracking 7

Creates the code snipped for the tracking.

Parameters

array $variables:

Return value

markup

2 theme calls to theme_google_adwords_tracking()
google_adwords_field_formatter_view in ./google_adwords.module
Implements hook_field_formatter_view().
google_adwords_page_build in ./google_adwords.module
Implements hook_page_build().

File

./google_adwords.module, line 266
Google Adwords Conversion Tracking Module

Code

function theme_google_adwords_tracking($variables) {
  $value_js = NULL;
  $value_param = NULL;
  if (strlen($variables['value'])) {
    $value_js = '  var google_conversion_value = "' . $variables['value'] . '";' . PHP_EOL;
    $value_param = '&value=' . rawurlencode($variables['value']);
  }
  return '<!-- Google Code for Purchase Conversion Page -->' . PHP_EOL . '<script language="JavaScript" type="text/javascript">' . PHP_EOL . '<!--' . PHP_EOL . '  var google_conversion_id = ' . $variables['conversion_id'] . ';' . PHP_EOL . '  var google_conversion_language = "' . $variables['language'] . '";' . PHP_EOL . '  var google_conversion_format = "' . $variables['format'] . '";' . PHP_EOL . '  var google_conversion_color = "' . $variables['color'] . '";' . PHP_EOL . '  var google_conversion_label = "' . $variables['label'] . '";' . PHP_EOL . $value_js . '//-->' . PHP_EOL . '</script>' . PHP_EOL . '<script language="JavaScript" src="https://www.googleadservices.com/pagead/conversion.js">' . PHP_EOL . '</script>' . PHP_EOL . '<noscript>' . PHP_EOL . '  <img height=1 width=1 border=0 src="https://www.googleadservices.com/pagead/conversion/' . $variables['conversion_id'] . '/?script=0' . $value_param . '&label=' . $variables['label'] . '">' . PHP_EOL . '</noscript>' . PHP_EOL;
}