1

I'm currently trying to find a way to demonstrate how many users are currently browsing my website. We use ColdFusion, but I haven't found a very reliable method of showing the user count. My current method sometimes displays weird user counts.

I see that Google Analytics now allows you to see how many users are currently on your website. Does anyone know if this information is accessible via javascript? As I would love to be able to show this to the other administrators as this information would be more inline with the reports that come out of GA.

Leigh
  • 28,765
  • 10
  • 55
  • 103
user125264
  • 1,809
  • 2
  • 27
  • 54

3 Answers3

2

Yes, Google offers Real-Time analytics now. You should be able to grab that data, yes. This article may help steer you in the right direction: http://www.sitepoint.com/google-analytics-custom-variables/

Dr Upvote
  • 8,023
  • 24
  • 91
  • 204
1

You can access real-time data through the Google Analytics Real-time API. Real-time data was just made available in August 2013 in Beta Mode. Not sure if it is publicly available.

If you are looking for a simple solution check out EmbeddedAnalytics. We have a "Real-Time Mapping Widget" which will display your real-time visitors overlaid on a map.

M Schenkel
  • 6,294
  • 12
  • 62
  • 107
0

I see that Google Analytics now allows you to see how many users are currently on your website, does anyone know if this information is accessible via javascript ?

Google provides an example of accessing it's API's via javascript. I haven't seen a javascript solution with a service account although it may be out there. Google APIs Client Library for JS

I did find this post: How to get an access to Google Drive API service account from web browser

You can use a service account to access this data without user interaction (log in authorization) on a ColdFusion server with relative ease.

The Real Time API is in beta now and you must request access: https://developers.google.com/analytics/devguides/reporting/realtime/v3/

After that, you will need to install the .jar files from Google which can be downloaded at Google Analytics API Client Library for Java into the WEB-INF/lib folder of the CF server.

Create the objects in ColdFusion. Here is a single example:

variables.HTTP_Transport = createObject("java", "com.google.api.client.http.javanet.NetHttpTransport").init();

You will then follow the instructions Google has for using the java objects almost exactly.

There are too many lines to list (but it's not too crazy) so you can follow this post: Google Analytics Real Time API Access with Service Account and ColdFusion

Community
  • 1
  • 1
jk.
  • 14,365
  • 4
  • 43
  • 58