[Seaside] Seaside Access/Activity Logging

Boris Popov, DeepCove Labs (SNN) boris at deepcovelabs.com
Tue Aug 24 09:16:07 UTC 2010


I would avoid web server logging in favour of modern tools like Google
Analytics, which allow you to track user's activity via variety of
dimensions, one of which is, obviously, page's URL. The following
extract from one of our apps shows rendering of GA tracking code from
updateRoot: that supports custom URL and multiple trackers (in our case
we CC clients' GA accounts using multiple tracker functionality new to
asynchronous GA), but the key here is _trackPageview option which you
can set to whatever free-form URL you choose instead of default
Seaside's URL. You can also add event tracking to all your links/buttons
or otherwise apply a variety of options GA offers to suit your needs,

 

http://code.google.com/apis/analytics/docs/gaJS/gaJSApi.html

 

updateRoot: aHtmlRoot

                [...]

self session useAnalytics

                                ifTrue: [aHtmlRoot javascript with:
(String streamContents: [:ws | self renderAnalyticsOn: ws])].

                [...]

 

renderAnalyticsOn: stream

 

                | trackers options |

                trackers := (Dictionary new)

                                                                at: ''
put: 'UA-XXXXXXX-XX';

                                                                at: 'b.'
put: 'UA-ZZZZZZZ-ZZ';

 
yourself.

                options := OrderedCollection new.

                trackers keysAndValuesDo: 

                                                [:tracker :accountid |

                                                | forThirdParty |

                                                forThirdParty := tracker
notEmpty.

                                                options add: (Array
with: tracker , '_setAccount' with: accountid).

                                                forThirdParty

                                                                ifTrue: 

 
[options

 
add: (Array with: tracker , '_setDomainName' with: 'none');

 
add: (Array with: tracker , '_setAllowLinker' with: true);

 
add: (Array with: tracker , '_setAllowHash' with: false)].

                                                options add: (Array
with: tracker , '_trackPageview' with: '/' , task trackingURL)].

                stream

                                nextPutAll: 'var _gaq = _gaq || [];';

                                nextPutAll: '_gaq.push('.

                options do: [:ea | stream json: ea] separatedBy: [stream
nextPut: $,].

                stream nextPutAll: ');'.

                stream

                                nextPutAll: '(function() {';

                                nextPutAll: 'var ga =
document.createElement(''script''); ga.type = ''text/javascript'';
ga.async = true;';

                                nextPutAll: 'ga.src = (''https:'' ==
document.location.protocol ? ''https://ssl'' : ''http://www'') +
''.google-analytics.com/ga.js'';';

                                nextPutAll: 'var s =
document.getElementsByTagName(''script'')[0];
s.parentNode.insertBefore(ga, s);';

                                nextPutAll: '})();'.

 

-Boris

 

-- 

DeepCove Labs Ltd.

+1 (604) 689-0322

4th floor, 595 Howe Street

Vancouver, British Columbia

Canada V6C 2T5

http://tinyurl.com/r7uw4

 

PacNet Services (Europe) Ltd.

+353 (0)61 714-360

Shannon Airport House, SFZ

County Clare, Ireland

http://tinyurl.com/y952amr

 

CONFIDENTIALITY NOTICE

 

This email is intended only for the persons named in the message header.
Unless otherwise indicated, it contains information that is private and
confidential. If you have received it in error, please notify the sender
and delete the entire message including any attachments.

 

Thank you.

 

From: seaside-bounces at lists.squeakfoundation.org
[mailto:seaside-bounces at lists.squeakfoundation.org] On Behalf Of Bart
Gauquie
Sent: 24 August 2010 07:14
To: Seaside - general discussion
Subject: Re: [Seaside] Seaside Access/Activity Logging

 

Hi,

 

What I've already 'hacked' in seaside is decorating all callbacks that
can happen.

I've used the decorating to capture all errors during callbacks and
collect them and show them on a notificationarea.

my code is at: http://www.squeaksource.com/NotificationsArea

 

Maybe you can use the same trick to log all callbacks?

 

Kind Regards,

 

Bart

 

On Mon, Aug 23, 2010 at 11:57 PM, Sven Van Caekenberghe <sven at beta9.be>
wrote:

Hi All,

In standard (non-heritic) web application frameworks, simple access
logging is quite useful to find out how your app is used in the wild.
The problem with Seaside is that most requests look pretty much the same
and do not contain enough information for after the fact analysis (like
http://localhost:8081/welcome?_s=0Sq2_xUpMPSWMOBg.R1&_k=DKeQJiyN2-ye2wCA
doesn't say we're on the configuration page).

Has anyone already 'solved' this 'problem' with some clever hack ? Maybe
some filter in the right place with some reflection magic ?

I guess manually inserting log statements (like augmenting the URL)
would be one way...

Thx,

Sven

_______________________________________________
seaside mailing list
seaside at lists.squeakfoundation.org
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




-- 
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere -
Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important
thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert
Einstein
However beautiful the strategy, you should occasionally look at the
results. - Sir Winston Churchill
It's not enough that we do our best; sometimes we have to do what's
required. - Sir Winston Churchill

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100824/0db4d870/attachment-0001.htm


More information about the seaside mailing list