You are here

function theme_web_widgets_tracking_code in Web Widgets 7

Same name and namespace in other branches
  1. 6 web_widgets.module \theme_web_widgets_tracking_code()

Enables the tracking of the

Parameters

$id: Web Property ID from Google Analytics

1 theme call to theme_web_widgets_tracking_code()
web_widgets_plugin_display_web_widgets::render in views/web_widgets_plugin_display_web_widgets.inc
Instead of going through the standard views_view.tpl.php, delegate this to the style handler.

File

./web_widgets.module, line 228
web_widgets module main. Contains the views api hook and theming functions.

Code

function theme_web_widgets_tracking_code($id) {

  // TODO: Should this theme web_widgets_tracking_code be declared in hook_theme()?
  return '
<script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
  try {
    var pageTracker = _gat._getTracker("' . $id . '");
    pageTracker._trackPageview();
  } catch(err) {}
</script>';
}