Module: getPageviewTracker

Methods

(inner) getPageviewTracker(config, loader, trackerGetter, sendBeacon) → {EventTracker}

Gets the appropriate analytics event tracker for logging virtual pageviews. Note this bypasses EventLogging in order to track virtual pageviews for pages where the DNT header (do not track) has been added. This is explained in https://phabricator.wikimedia.org/T187277.

Parameters:
Name Type Description
config Object
loader MwCodeLoader

that can source code that obeys the EventLogging api specification.

trackerGetter function

when called returns an instance of MediaWiki's EventLogging client

sendBeacon function

see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon

Source:
Returns:
Type
EventTracker

(inner) getSendBeacon(navigatorObj) → {function}

Gets a function that can asynchronously transfer a small amount of data over HTTP to a web server.

Parameters:
Name Type Description
navigatorObj Window.Navigator
Source:
Returns:
Type
function

(inner) limitByEncodedURILength(sourceUrl, maxLength) → {string}

Truncates a string to a maximum length based on its URI encoded value.

Parameters:
Name Type Description
sourceUrl string

source string

maxLength number

maximum length

Source:
Returns:

string is returned in the same encoding as the input

Type
string

(inner) prepareEventData(eventData) → {Object}

Convert Title properties into mediawiki canonical form and limit the length of source_url.

Parameters:
Name Type Description
eventData Object
Source:
Returns:
Type
Object

(inner) titleCase(word) → {string}

Convert the first letter of a string to uppercase.

Parameters:
Name Type Description
word string
Source:
Returns:
Type
string