Google analytics

Is it possible to use Google analytics with Servoy webclient solutions ? If yes, how to implement it.

boonstrj:
Is it possible to use Google analytics with Servoy webclient solutions ? If yes, how to implement it.

Did you learn how to do this?

Google Analytics (and others like Piwik) use a piece of HTML/Javascript code that you put inside your HTML.
So you could simply store that piece of code in a global variable and use this as a dataprovider for a (hidden) HTML_AREA field on your forms.
This will ‘inject’ this piece of code in your web-client page.

Hope this helps.

Thanks Robert, I was wondering how to get it into the HTML. Nice solution, thanks.

So just something like this as the dataprovider? Does it need and around it?

var GoogleAnalytics = '<script type="text/javascript">\n\n  var _gaq = _gaq || [];\n  _gaq.push([\'_setAccount\', \'UA-123456789-2\']);\n  _gaq.push([\'_trackPageview\']);\n\n  (function() {\n    var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;\n    ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';\n    var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);\n  })();\n\n</script>';

Good question. I am not sure. You would think you could do without since it’s already inside HTML tags.
I suggest you try it and see what HTML it produces in the browser.

By the way you can keep your code more readable inside Developer by escaping the returns like so:

var GoogleAnalytics = '<script type="text/javascript">\n\
\n\
  var _gaq = _gaq || [];\n\
  _gaq.push([\'_setAccount\', \'UA-123456789-2\']);\n\
  _gaq.push([\'_trackPageview\']);\n\
  (function() {\n\
    var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;\n\
    ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';\n\
    var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);\n\
  })();\n\
\n\
</script>';

Hope this helps

Google analytics works by tracking URL’s. Given that a typical Servoy webclient URL looks like this and changes per user session for any particular form:

http://host/servoy-webclient/?x=Udgnmri3q-90609tjCZSRw

Good luck figuring out what forms and records are popular. Now if you had meaningful URL’s describing location down to the workspace, form, record and record ID…

http://demo.data-sutra.com/developer/customer/rentfield-enterprises/141

Then looking at your google analytics is going to make a lot more sense :) viewtopic.php?f=20&t=19250&start=15#p104734

david:
Good luck figuring out what forms and records are popular. Now if you had meaningful URL’s describing location down to the workspace, form, record and record ID…

Good point! I like what you’ve done with the Data-Sutra UI.
Fortunately I just need it on the login page gather some data on browsers.