const mixinafGoogleAnalytics::GoogleAnalytics
afGoogleAnalytics::GoogleAnalytics
(Service) - Renders the Google Universal Analytics script and sends page views and events.
See analytics.js for details.
- accountDomain
- abstract Str? accountDomain()- Returns the domain used to setup the google script. 
- accountNumber
- abstract Str accountNumber()- Returns the account used to setup the google script. 
- pageViewRendered
- abstract Bool pageViewRendered()- Returns - trueif the page has already rendered Javascript to send a page view event.- This allows individual pages to send page views for canonical URLs and a layout component to send general page views if the page hasn't done so. 
- renderCmd
- abstract Void renderCmd(Str cmd, Obj? arg1 := null, Obj? arg2 := null, Obj? arg3 := null, Obj? arg4 := null)- Renders Javascript to add an arbitrary command to the command queue. Example: - renderCmd("create", "UA-XXXXX-Y", "auto")- would render: - ga('create', 'UA-XXXXX-Y', 'auto');- Arguments have - toStrexecuted on them before rendering.- If the last argument is a Map, then it is serialised as JSON and used as the - fieldsObject. Example:- renderCmd("create", [ "trackingId" : "UA-XXXXX-Y", "cookieDomain" : "auto" ])- would render: - ga('create', { 'trackingId' : 'UA-XXXXX-Y', 'cookieDomain' : 'auto' });
- renderEvent
- abstract Void renderEvent(Str category, Str action, Str? label := null, Num? value := null, [Str:Obj?]? fieldOptions := null)- Renders Javascript to send an event to google analytics. 
- renderPageView
- abstract Void renderPageView(Uri? url := null, [Str:Obj?]? fieldOptions := null)- Renders Javascript to send a page view to google analytics. If - urlis given then it should start with a leading- /, e.g.- /about- Note that if a URL is NOT supplied, then the query string is stripped from the rendered URL. This usually makes sense for Fantom web apps as query strings do not generally denote unique pages.