Closed (fixed)
Project:
Cufón
Version:
6.x-1.0-beta4
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Jan 2011 at 07:03 UTC
Updated:
23 Aug 2012 at 11:21 UTC
Hi,
My Google Analytics module works fine. But when i view the page source of my drupal site, i see two closing script tags for the Google Analytics script as follows:
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-20414996-1"]);_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>
I have to remove the duplicate
. How do i do it?
Thanks
Comments
Comment #1
hass commentedThis is not from the GA module.
Comment #2
jorism commentedI had a similar problem with a javascript that protects e-mail addresses against spam.
In my case, the whole < script >< / script > block gets duplicated
For this specific case, I found a 'dirty patch': just surround your scripting code by a check whether a variable used in the script already exists.
For example:
On the second pass, the variable already exists and so the script will not be executed again...
(It's not from GA, so this thread can be set to fixed, I am sorry for the inconvenience)
Comment #3
ice5nake commentedI am having the same problem with my Google Analytics script.
This has to be getting assigned to the closure template variable twice somehow.
Not sure if this is pertinent but I am using a custom Zen sub-theme.
I'll help in anyway I can.
Comment #4
hass commentedCheck if you Zen theme have this tag in the templates, please. It seems not from core.
Comment #5
hass commentedComment #6
ice5nake commentedI suspect the problem is another module not implementing something correctly. I'll try to help by looking into this if I get time.
I have lightbox2, sharethis, cufon, and admin menu which all appear to add code to the footer but only googleanalytics is showing up twice.
Although I strongly suspect this is the cufon modules fault as described here: http://drupal.org/node/591838 and mentioned here http://drupal.org/node/734630
Comment #7
hass commentedcufon is big sh**. There is an issue with a patch in the cufon queue... this is therefore a duplicate.
Comment #8
hass commentedYou need latest DEV. It must be later than beta4...
Comment #9
hass commentedComment #10
kristofdg commentedHi
I also had to problem with duplicate google_analytic scripts and tracked it down to this line: $vars['closure'] = theme('closure') in cufon_preproccess_page. See code snippet.
Comment #11
troky commentedProbably fixed in 6.x-1.x-dev.
Re-open issue if problem persists.