Google analytics

Forum to discuss the Web client version of Servoy.

Google analytics

Postby boonstrj » Tue Aug 18, 2009 11:17 am

Is it possible to use Google analytics with Servoy webclient solutions ? If yes, how to implement it.
Jeroen Boonstra
2Serve-IT

Servoy version 5.2.13/6.1.x/7.1.0
boonstrj
 
Posts: 63
Joined: Mon Jan 07, 2008 11:49 am
Location: Netherlands

Re: Google analytics

Postby antonio » Sat Mar 23, 2013 2:45 pm

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

Did you learn how to do this?
Tony
Servoy 8 - 2022.03 LTS
antonio
 
Posts: 638
Joined: Sun Apr 02, 2006 2:14 am
Location: Australia

Re: Google analytics

Postby ROCLASI » Sat Mar 23, 2013 3:32 pm

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.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Google analytics

Postby antonio » Sat Mar 23, 2013 4:07 pm

Thanks Robert, I was wondering how to get it into the HTML. Nice solution, thanks.
Tony
Servoy 8 - 2022.03 LTS
antonio
 
Posts: 638
Joined: Sun Apr 02, 2006 2:14 am
Location: Australia

Re: Google analytics

Postby antonio » Sat Mar 23, 2013 4:13 pm

So just something like this as the dataprovider? Does it need <html> and </html> around it?

Code: Select all
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>';
Tony
Servoy 8 - 2022.03 LTS
antonio
 
Posts: 638
Joined: Sun Apr 02, 2006 2:14 am
Location: Australia

Re: Google analytics

Postby ROCLASI » Sat Mar 23, 2013 5:22 pm

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:
Code: Select all
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
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Google analytics

Postby david » Sat Mar 23, 2013 6:58 pm

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 Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Google analytics

Postby antonio » Sun Mar 24, 2013 3:54 am

david wrote: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.
Tony
Servoy 8 - 2022.03 LTS
antonio
 
Posts: 638
Joined: Sun Apr 02, 2006 2:14 am
Location: Australia


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 8 guests