There is an extra set of script tags getting spit out currently. There is no longer the need to wrap the GA code within script tag markup. The drupal_pre_render_scripts function now handles this.

Current:

<script>
<!--//--><![CDATA[//><!--
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
  _gaq.push(['_trackPageview']);

  (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);
  })();

  </script>
//--><!]]>
</script>

Expected:

<script type="text/javascript">
<!--//--><![CDATA[//><!--

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
  _gaq.push(['_trackPageview']);

  (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);
  })();

//--><!]]>
</script>

drupal_pre_render_scripts()
http://api.drupal.org/api/drupal/core!includes!common.inc/function/drupa...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

desmondmorris’s picture

Status: Active » Needs review

Here is the patch. I also added the attributes option to the drupal_add_js function call to include the type attribute to the script tag. Though, it looks like the attributes option is not quite working as expected (http://drupal.org/node/1664602)

desmondmorris’s picture

Argh, I always forget the attachement

frob’s picture

Status: Needs review » Fixed

commited

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

spacing