Google Groups Home Help | Sign in
Discussions > Troubleshooting > New ga.js not working with ASP or Blogger ?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  18 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
AnalyticsPro Google employee  
View profile
(4 users)  More options Dec 18 2007, 6:39 pm
From: AnalyticsPro
Date: Tue, 18 Dec 2007 15:39:18 -0800 (PST)
Local: Tues, Dec 18 2007 6:39 pm
Subject: New ga.js not working with ASP or Blogger ?
If you're having issues installing the ga.js on either an ASP site or
Blogger, please use the following code instead:

<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">
var pageTracker = _gat._getTracker("UA-xxxx-xx");
pageTracker._initData();
pageTracker._trackPageview();

(replace xxxx-xx with your Google Analytics account number)

The new code passes W3c XHTML 1.0 strict compliance verification,
mitigates Nested Script errors on ASP on IIS, and installs on Blogger
and will be the default code provided within the Google Analytics
interface.

Thanks to everyone who both reported the issue and suggested fixes!


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Girdwood  
View profile
(1 user)  More options Dec 18 2007, 8:30 pm
From: Andrew Girdwood
Date: Tue, 18 Dec 2007 17:30:04 -0800 (PST)
Local: Tues, Dec 18 2007 8:30 pm
Subject: Re: New ga.js not working with ASP or Blogger ?
You need to make sure you close the </script> tag after the last
pageTracker call too.

<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">
var pageTracker = _gat._getTracker("UA-xxxx-xx");
pageTracker._initData();
pageTracker._trackPageview();
</script>

On Dec 18, 11:39 pm, AnalyticsPro wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Philipp Lenssen  
View profile
(1 user)  More options Dec 19 2007, 7:19 am
From: Philipp Lenssen
Date: Wed, 19 Dec 2007 04:19:19 -0800 (PST)
Local: Wed, Dec 19 2007 7:19 am
Subject: Re: New ga.js not working with ASP or Blogger ?
Why does Google not validate their code before publishing? The lack of
conformance with the W3C is causing troubles for some products, as
this case shows.

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ijd  
View profile
 More options Dec 19 2007, 8:18 am
From: ijd
Date: Wed, 19 Dec 2007 05:18:54 -0800 (PST)
Local: Wed, Dec 19 2007 8:18 am
Subject: Re: New ga.js not working with ASP or Blogger ?
Why not hide javascript from old browsers (and fussy validators) using
the comments hack? It would save all the unescaping. At least it seems
to be accepted by blogger. Not sure if it works (generates data)
though.

i.e.
<script>
<!-- hide javascript
...
// end hide -->
</script>

On Dec 19, 8:39 am, AnalyticsPro wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tony Ruscoe  
View profile
 More options Dec 19 2007, 8:58 am
From: Tony Ruscoe
Date: Wed, 19 Dec 2007 05:58:49 -0800 (PST)
Local: Wed, Dec 19 2007 8:58 am
Subject: Re: New ga.js not working with ASP or Blogger ?

> Why not hide javascript from old browsers (and fussy validators) using
> the comments hack? It would save all the unescaping.

That wouldn't have stopped the Nested Script errors in ASP though.

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Accettura  
View profile
 More options Dec 19 2007, 11:13 am
From: Robert Accettura
Date: Wed, 19 Dec 2007 08:13:35 -0800 (PST)
Local: Wed, Dec 19 2007 11:13 am
Subject: Re: New ga.js not working with ASP or Blogger ?
Generally for xhtml you'd use:

<script type="text/javascript">
  // <![CDATA[
    your code goes here
 // ]]>
</script>

That will always validate in xhtml 1.0 strict as well as xhtml 1.1,
unless you've got a CDATA in your js... but that's easy to fix by
splitting it.

On Dec 19, 8:18 am, ijd wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bridgeman  
View profile
 More options Dec 19 2007, 2:21 pm
From: Bridgeman
Date: Wed, 19 Dec 2007 11:21:03 -0800 (PST)
Local: Wed, Dec 19 2007 2:21 pm
Subject: Re: New ga.js not working with ASP or Blogger ?
I've added the new-new GA code, as posted above, to our site and it
returns two errors: "_gat not defined" and "Error: unterminated string
literal.... Source Code:var gaJsHost = (("https:" ==
document.location.protocol) ? "https://".

Any idea what is causing this to happen?

Thanks for any input,

Adam


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CX  
View profile
 More options Dec 19 2007, 4:16 pm
From: CX
Date: Wed, 19 Dec 2007 13:16:00 -0800 (PST)
Subject: Re: New ga.js not working with ASP or Blogger ?
ASP returns an error that the scripts are nested, Instead:

Use a VBScript Sub to write all your ga.js.

'Example with page title
Call WriteGoogleAnalitycsCode("Page Title")
'Example without page title
Call WriteGoogleAnalitycsCode("")

Sub WriteGoogleAnalitycsCode(pageTitle)

response.write("<scr" & "ipt type=""text/javascript"">" & vbcr)
response.write("var gaJsHost = ((""https:"" ==
document.location.protocol) ? ""https://ssl."" : ""http://www."");" &
vbcr)
response.write("document.write(""\<script src='"" + gaJsHost +
""google-analytics.com/ga.js' type='text/javascript'>\<\/
script>"" );"
& vbcr)
response.write("</scr" & "ipt>" & vbcr)
response.write("<scr" & "ipt type=""text/javascript"">" & vbcr)
response.write("var pageTracker = _gat._getTracker(""UA-xxxx-xx"");"
& vbcr)
response.write("pageTracker._initData();" & vbcr)
response.write("pageTracker._trackPageview(")
If LenB(pageTitle) <> 0 Then response.write(Chr(34) & pagetitle &
Chr(34)) End If
response.write(");" & vbcr)
response.write("</scr" & "ipt>" & vbcr)
response.write("" & vbcr)

End Sub


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ShoreTel  
View profile
 More options Dec 20 2007, 2:10 pm
From: ShoreTel
Date: Thu, 20 Dec 2007 11:10:49 -0800 (PST)
Local: Thurs, Dec 20 2007 2:10 pm
Subject: Re: New ga.js not working with ASP or Blogger ?
Or just write the version (HTTP/HTTPS) your site uses and be done with
it, and also XHTML compliant

On Dec 19, 1:16 pm, CX wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bridgeman  
View profile
 More options Dec 20 2007, 2:46 pm
From: Bridgeman
Date: Thu, 20 Dec 2007 11:46:41 -0800 (PST)
Local: Thurs, Dec 20 2007 2:46 pm
Subject: Re: New ga.js not working with ASP or Blogger ?
What would the correct version look like for a HTTP site that is XHTML
1.0 Transitional? We are not running Blogger or ASP and still having
problems tracking/validating.

Thanks for helping a java newbie! :)


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ijd  
View profile
 More options Dec 21 2007, 3:05 am
From: ijd
Date: Fri, 21 Dec 2007 00:05:51 -0800 (PST)
Local: Fri, Dec 21 2007 3:05 am
Subject: Re: New ga.js not working with ASP or Blogger ?
I had a similar problem when cutting and pasting the code that one of
the strings was split over 2 lines. make sure there are no extra
newlines in the code you have.

On Dec 20, 4:21 am, Bridgeman wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ShoreTel  
View profile
 More options Dec 21 2007, 1:46 pm
From: ShoreTel
Date: Fri, 21 Dec 2007 10:46:40 -0800 (PST)
Local: Fri, Dec 21 2007 1:46 pm
Subject: Re: New ga.js not working with ASP or Blogger ?
Here's the instructions for bypassing the auto-https detection script.
http://groups.google.com/group/analytics-help-troubleshoot/msg/e712ab...

On Dec 20, 11:46 am, Bridgeman wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
containerantiques  
View profile
 More options Feb 15, 12:13 am
From: containerantiques
Date: Thu, 14 Feb 2008 21:13:59 -0800 (PST)
Local: Fri, Feb 15 2008 12:13 am
Subject: Re: New ga.js not working with ASP or Blogger ?
When I post the below code on Blogger.com I get the following error

ERROR
Your HTML cannot be accepted: Tag is not closed: <script type="text/
javascript">

What can I do?? Please help.
Much appreciation.

On Dec 18 2007, 3:39 pm, AnalyticsPro wrote: