Custom route definition

Extended Google Analytics measuremet.

Defined routes may not solve all problems. If you need to define your own specific route, create an object with four following methods:

  • match - checks whether the route matches the actual URL or not. Returns bool type.
  • assemble - returns a new URL. It is sent as a virtual pageview if method match returns true.
  • exec - function will be called before tracking pageview if the route matches the current URL (method match returns true).
  • processAfterDomReady - if true, _trackPageview is proceeded just after DOM is ready.

In the following code are all required methods with their headers.

function MyRoute() 
{ /** * Returns true if current URL matches this route, false othercase * * @param url string current URL * @return bool */ this.match = function(url : string) : bool ; /** * Returns a new URL - this value is tracked as virtual pageview * * @param url string * @return string */ this.assemble = function(url : string) : string ; /** * This method is execured before _trackPageview * when method match returns true */ this.exec = function(void) : void ; /** * If returns true, _trackPageview is proceeded after DOM is ready * If returns false, _trackPageview is proceeded just after _gas.create is called * * @param url string * @return bool */ this.processAfterDomReady = function(url : string) : bool ; }