title: Set utm_source and utm_term for trackpageView in google analytics
body: <p>I need to record a page view using analytics for a certain url with values of utm_source and utm_term which are sent from serverside.
  I thought this would do the job:</p>
  
  <pre><code>&lt;script&gt;
  
  var trackPageViewUrl = window.location.pathname + 
                         "?utm_source={utm_source}&amp;utm_term={utm_term}";
  trackPageViewUrl = trackPageViewUrl.replace("{utm_source}", '&lt;%= ServerSideVar1 %&gt;')
                                      .replace("{utm_term}", '&lt;%= ServerSideVar2 %&gt;');
  
  // Tracking code
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXX-X']);
  _gaq.push(['_trackPageview', trackPageViewUrl]);    
  
  (function () {
              var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
              ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
              var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
          })();
  &lt;/script&gt;
  </code></pre>
  
  <p>No the problem is that I see pageviews from the url window.location.pathname but there are no values for utm_source and utm_term on which I could filter.</p>
  
  <p>Thanks in advance.</p>