@ Nonnull public static JSInvocation createEventTrackingCode ( @ Nonnull final String sCategory , @ Nonnull final String sAction , @ Nullable final String sLabel , @ Nullable final Integer aValue ) { final JSArray aArray = new JSArray ( ) . add ( "_trackEvent" ) . add ( sCategory ) . add ( sAction ) ; if ( StringHelper . hasText ( sLabel ) ) aArray . add ( sLabel ) ; if ( aValue != null ) aArray . add ( aValue . intValue ( ) ) ; return JSExpr . ref ( "_gaq" ) . invoke ( "push" ) . arg ( aArray ) ; }
Set this in the onclick events of links to track them