Skip to content

Instantly share code, notes, and snippets.

@masugadesign
Created March 8, 2010 18:46
Show Gist options
  • Save masugadesign/325449 to your computer and use it in GitHub Desktop.
Save masugadesign/325449 to your computer and use it in GitHub Desktop.
<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>
{if segment_1 == "search" && segment_2 != ""}
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-000000-1");
pageTracker._initData();
terms='{exp:search:keywords}';
searchterms=terms.toLowerCase().replace(/\s/g,'+');
pageTracker._trackPageview('/search/{if segment_2 == "noresults"}noresults/{/if}?q='+searchterms);
} catch(err) {}
</script>
{if:else}
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-000000-1");
pageTracker._trackPageview();
} catch(err) {}</script>
{/if}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment