Wednesday, January 25, 2012

Re: Analytics Integration in GWT - GET request for __utm.gif not being sent

Not sure what is going on,

but that's the way gwtp is doing Google Analytics:
http://code.google.com/p/gwt-platform/source/browse/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/googleanalytics/GoogleAnalyticsImpl.java

ra

On Wed, Jan 25, 2012 at 10:53 PM, Dugald <dugald.morrow@gmail.com> wrote:
>
> From http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html,
> it says:
>
> Your compiled script runs in a nested frame, and $wnd and $doc are
> automatically initialized to correctly refer to the host page's window
> and document.
>
> Can someone perhaps tell me if they this this is the reason why the
> code isn't running as expected.
>
>
> On Jan 25, 2:42 pm, Dugald <dugald.mor...@gmail.com> wrote:
>> I have a GWT application (http://www.councilmapserver.com/cms-demo/
>> CMS.html) in which I dynamically configure the analytics code. The
>> code is as follows:
>>
>> private native void initialiseAnalytics(final String analyticsAccount,
>> final String domainName) /*-{
>>   try {
>>     $wnd._gaq = $wnd._gaq || [];
>>     $wnd._gaq.push(['_setAccount', analyticsAccount]);
>>     $wnd._gaq.push(['_setDomainName', domainName]);
>>     $wnd._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);
>>     })();
>>   } catch (e) {
>>     $wnd.alert("JSNI method GoogleAnalytics.initialiseAnalytics()
>> threw an exception:" + e);
>>   }
>>
>> }-*/;
>>
>> The code executes without reporting any errors, however, the tracking
>> beacon is never sent (no GET request for__utm.gifis made).
>>
>> I have created a similar piece of code with straight HTML and
>> JavaScript athttp://www.councilmapserver.com/AnalyticsTest/AnalyticsTest-LateDynam...
>> which does result in the tracking beacon being sent. Can anyone shed
>> some light into what the differences may be?
>
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>

--
inc: http://ars-machina.raphaelbauer.com
tech: http://ars-codia.raphaelbauer.com
web: http://raphaelbauer.com

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment