jlogger.js

Collected functions and objects for the CNET “Redball” family of sites.

Dependancies

mootoolsMoo.js, Utility.js, String.js, Array.js, Function.js, Element.js, Dom.js
cnet librariesdbug.js

Author

Aaron Newton, <aaron [dot] newton [at] cnet [dot] com>

Summary
jlogger.jsCollected functions and objects for the CNET “Redball” family of sites.
JloggerEnables clientside logging for any client side data or events.
Properties
pingAdds the call to DW with the passed in url; if url is not defined, it will create one with the options that were passed in when it was created.
pingTagUse this instance of Jlogger and all its options, but ping DW with a different tag.
stopObservingStops pingging DW; can be turned back on with startObserving
startObservingStarts pinging DW again; see also stopObserving.
Change Log$Source: /cvs/main/flatfile/html/rb/js/global/cnet.global.framework/common/utilities/jlogger.js,v $ $Log: jlogger.js,v $ Revision 1.11 2007/03/10 00:37:10 newtona docs update

Jlogger

Enables clientside logging for any client side data or events.  You can capture any data the browser knows; resolution, scroll distance (see JlScroller), mouseover, etc.

Reports

Reports for Jlogger events can be found in CNET DW reports at

CNET Reporting > Shared Reports > Redball > Miscellaneous > JLogger Events

Arguments

optionsoptional, an object containing options.

Options

tag(required) the tag for DW
element(optional) the id of the element or the DOM element itself or false; use false if you want to call //.ping yourself, use a dom element if you want to observe it using the event option below. defaults to false
event(optional) the event that the element captures; load, click, etc.  (do not include “on”)
ontid(string or integer) the ontology id, defaults to the nodeId of the page
pId(string or integer) the product id, defaults to the pageType of the page
edId(string or integer) the edition id, defaults to the editionId of the page
siteId(string or integer) the site Id, defaults to the siteId of the page
useraction(optional; string or integer) the urs user action id, not used if not included
fireOnce(boolean; optional) only fire this event once (true); fire every time (false; default)

Example

//ping DW when the window loads
new Jlogger({
ontid: '20',
siteId:'4',
pId:'2001',
tag:'windowLoad',
element: window,
event: 'load',
fireOnce: true
});

//ping dw when the user clicks on some element
new Jlogger({
ontid: '20',
siteId:'4',
pId:'2001',
tag:'somethingClicked',
element: 'myElementId',
event: 'click',
});

//ping DW NOW
new Jlogger({
ontid: '20',
siteId:'4',
pId:'2001',
tag:'someAction'
}).ping();

Note

See JlScroller class for scroll capturing.

Summary
Properties
pingAdds the call to DW with the passed in url; if url is not defined, it will create one with the options that were passed in when it was created.
pingTagUse this instance of Jlogger and all its options, but ping DW with a different tag.
stopObservingStops pingging DW; can be turned back on with startObserving
startObservingStarts pinging DW again; see also stopObserving.

Properties

ping

Adds the call to DW with the passed in url; if url is not defined, it will create one with the options that were passed in when it was created.  Will not ping if fireOnce = true and this has already been fired.

Arguments

url(string) the url to append to the dom (optional)
force(boolean) execute the ping even if fireOnce=true and this has already been fired

pingTag

Use this instance of Jlogger and all its options, but ping DW with a different tag.

Arguments

tag(string) the tag to use in the ping.
force(boolean) execute the ping even if fireOnce=true and this has already been fired

Example

var jlWinLoad = new Jlogger({tag: 'myTag', element: document.body, event: 'load', pId: 12345});
//later...
jlWinLoad.pingTag('someOtherTag'); //pings DW with the new tag
//but doesn't alter the settings of the instance

stopObserving

Stops pingging DW; can be turned back on with startObserving

startObserving

Starts pinging DW again; see also stopObserving.

Change Log

$Source: /cvs/main/flatfile/html/rb/js/global/cnet.global.framework/common/utilities/jlogger.js,v $ $Log: jlogger.js,v $ Revision 1.11 2007/03/10 00:37:10 newtona docs update

Revision 1.10 2007/03/10 00:31:10 newtona .pingDW is now just .ping element and event are no longer required (so jloggers can just get fired inline) executeNow is deprecated; just use new Jlogger().ping() added support for cval and ctype

Revision 1.9 2007/03/09 23:57:18 newtona docs update

Revision 1.8 2007/03/09 23:23:23 newtona * empty log message *

Revision 1.7 2007/03/09 20:15:03 newtona numerous bug fixes

Revision 1.6 2007/03/09 18:42:27 newtona options.name is no longer required or used

Revision 1.5 2007/02/21 00:30:18 newtona switched Class.create to Class.empty

Revision 1.4 2007/02/07 20:52:22 newtona implemented Options class implemented Events class

Revision 1.3 2007/01/26 05:56:03 newtona syntax update for mootools 1.0 docs update

Revision 1.2 2007/01/22 21:54:17 newtona updated for mootools version 1.0 updated namespaces to capitazlied values

Revision 1.1 2007/01/09 02:39:35 newtona renamed addons directory to “common” directory

Revision 1.4 2006/11/13 23:54:31 newtona added some error handling

Revision 1.3 2006/11/03 19:42:06 newtona moved jlscroller into it’s own file

Revision 1.2 2006/11/03 19:38:32 newtona Cleaning up a bit of code and documentation, mainly around the way the class stores options.

Revision 1.1 2006/11/02 21:28:08 newtona checking in for the first time.

Starts pinging DW again; see also <stopObserving>.
Stops pingging DW; can be turned back on with <startObserving>
My Object Oriented javascript.
Contains Utility functions
Contains String prototypes and Number prototypes.
function $A(array,
start,
length)
returns a copy of the array.
Same as Array.copy, but as function.
function $each(iterable,
fn,
bind)
Use to iterate through iterables that are not regular arrays, such as builtin getElementsByTagName calls, arguments of a function, or an object.
Contains Array prototypes, $A, $each
Contains Function prototypes and utility functions .
function $(el)
returns the element passed in with all the Element prototypes applied.
Contains useful Element prototypes, to be used with the dollar function $.
This extends the Element prototype.
Css Query related function and Element extensions
Wrapper for the firebug console.log() function.
Adds Scroll captures to the jlogger class; extends <jlogger>.