diff options
author | Artur Signell <artur.signell@itmill.com> | 2009-02-23 10:53:41 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2009-02-23 10:53:41 +0000 |
commit | 34407602fcffc73301f11bf696e13dcdd04c918e (patch) | |
tree | 4b7b660e500162634270df4c8fda193093bd973d /src/com/itmill | |
parent | 3a7e792938264c60e069deec3d28d0f9d9fce1bd (diff) | |
download | vaadin-framework-34407602fcffc73301f11bf696e13dcdd04c918e.tar.gz vaadin-framework-34407602fcffc73301f11bf696e13dcdd04c918e.zip |
Fix for # 2646: Google analytics client side component disabled for localhost address
http://dev.itmill.com/ticket/2646
svn changeset:6937/svn branch:trunk
Diffstat (limited to 'src/com/itmill')
-rw-r--r-- | src/com/itmill/toolkit/demo/sampler/gwt/client/ui/IGoogleAnalytics.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/demo/sampler/gwt/client/ui/IGoogleAnalytics.java b/src/com/itmill/toolkit/demo/sampler/gwt/client/ui/IGoogleAnalytics.java index 495dc1527d..fcd3574e64 100644 --- a/src/com/itmill/toolkit/demo/sampler/gwt/client/ui/IGoogleAnalytics.java +++ b/src/com/itmill/toolkit/demo/sampler/gwt/client/ui/IGoogleAnalytics.java @@ -19,6 +19,10 @@ public class IGoogleAnalytics extends Widget implements Paintable { } public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { + if (isLocalHostUrl()) { + // Do not track localhost page views + return; + } String trackerId = uidl.getStringAttribute("trackerid"); String pageId = uidl.getStringAttribute("pageid"); String domainName = uidl.getStringAttribute("domain"); @@ -35,6 +39,13 @@ public class IGoogleAnalytics extends Widget implements Paintable { } } + private native boolean isLocalHostUrl() + /*-{ + var location = $wnd.location; + var re = /^http:\/\/(localhost|127.0.0.1)/; + return re.test(location); + }-*/; + private native String trackPageview(String trackerId, String pageId, String domainName) /*-{ |