I am sure if you are a Google Analytics user, you probably have been waiting for an application for the real-time data provided in Google Analytics web interface. Which currently is the most desired feature on issues, 330 stars as of writing.
But you know this is Google, you would never know when you could have it, or even possible to get it. Anyway, I had thrown away my hope for such API long time ago.
Probably about a week ago, I began to get in touch with Google App Engine again and yesterday I recalled Google App Engine recently added support geographical location in SDK 1.6.5 for incoming requests about a month ago via request headers X-AppEngine-Country, X-AppEngine-Region, X-AppEngine-City, and X-AppEngine-CityLatLong. It would be nice to have a quick way to show those information of visitors.
The thing is I would not use what I have coded, because I don’t actually need to see incoming visitors, but it’s fun to code something. This quick way must be simple and efficient, never touch about datastore, not even memory cache. So I looked up in documentation, Channel and XMPP APIs are two very nice way to implement as the notification channel. I chose XMPP and the implementation is really simple.
You can get all files on Gist. The main handler script is
The handler QuickTrackJSON receives the request from a client script:
Then it will send out the XMPP message. You will need to send invite beforehand via /qt-invite, so you can actually receive messages. To include this client script, here is the code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script src="http://<APPID>.appspot.com/qt.js"></script>
Here is an example output in Gmail’s chat window:
The output is not a summarized data, but it’s not hard to implement, only I don’t plan to use this, so I coded it as simple as possible for demonstration purpose.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.