Google Analytics javascript and dynamic SQL

From: Bob Hartman-Berrier <eo838014_at_qny.pn>
Date: Fri, 29 Oct 2010 14:59:35 +0000 (UTC)
Message-ID: <Xns9E207A0159E89rb838014dalca_at_94.75.214.90>



Hello,

I need to insert Google Analytics' javascript tracking code (either the newer, asynchronous or the older, synchronous, mode) into dynamicallygenerated  SQL so that the number of "Confirmation of Enrolment" letters which are printed by Dalhousie University students can be tracked. I am not having success at this, and ask your help.

The older, synchronous javascript used in the university's main, static html page has such stock GA code as

 <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"));

And includes the customized code

  dalMainTracker._setDomainName('dal.ca');
  dalMainTracker._addOrganic('search.dal.ca', 'q');
  dalMainTracker._addOrganic('googlesyndicatedsearch.com', 'q'); 

The newer model is simpler, but presents its own challenges with leading underscores and brackets. I've prefaced all the javascript lines with
"htp.p" and tried putting literals into variables thusly:

  htp.p('</script>')
  htp.p('<script ' || gaTyp || '"text/javascript">');

I've tried both versions of Google's code. The sqlplus compiler complains mightily about the single/double quote combinations, and I have not gotten a valid combination of double and triple quotes to work, and neither have I gotten a working escape-character process to work in the compiler, telling it to ignore quotes, underscores, brackets, etc.

Has anybody gotten Google Analytics (or other javascript) to work in dynamic SQL packages? If you have, would you share your technique(s) and/or code samples?  

Many thanks,

*-*-*-*-*
Bob Hartman-Berrier
Administrative Computing
Dalhousie University Received on Fri Oct 29 2010 - 09:59:35 CDT

Original text of this message