f a window.onerror handler is already defined we will make * sure to call this previously registered error handler after tracking the error. * * By default we return false in the window.onerror handler to make sure the error still * appears in the browser's console etc. Note: Some older browsers might behave differently * so it could happen that an actual JavaScript error will be suppressed. * If a window.onerror handler was registered we will return the result of this handler. * * Make sure not to overwrite the window.onerror handler after enabling the JS error * tracking as the error tracking won't work otherwise. To capture all JS errors we * recommend to include the Piwik JavaScript tracker in the HTML as early as possible. * If possible directly in before loading any other JavaScript. */ /*REMOVING METHODS WE WILL NOT SUPPORT enableJSErrorTracking: function () { if (enableJSErrorTracking) { return; } enableJSErrorTracking = true; var onError = windowAlias.onerror; windowAlias.onerror = function (message, url, linenumber, column, error) { trackCallback(function () { var category = 'JavaScript Errors'; var action = url + ':' + linenumber; if (column) { action += ':' + column; } logEvent(category, action, message); }); if (onError) { return onError(message, url, linenumber, column, error); } return false; }; },*/ /** * Disable automatic performance tracking */ /*REMOVING METHODS WE WILL NOT SUPPORT disablePerformanceTracking: function () { configPerformanceTrackingEnabled = false; },*/ /** * Set the server generation time. * If set, the browser's performance.timing API in not used anymore to determine the time. * * @param int generationTime */ /*REMOVING METHODS WE WILL NOT SUPPORT setGenerationTimeMs: function (generationTime) { configPerformanceGenerationTime = parseInt(generationTime, 10); },*/ /** * Set heartbeat (in seconds) * * @param int heartBeatDelayInSeconds Defaults to 15. Cannot be lower than 1. */ /*REMOVING METHODS WE WILL NOT SUPPORT enableHeartBeatTimer: function (heartBeatDelayInSeconds) { heartBeatDelayInSeconds = Math.max(heartBeatDelayInSeconds, 1); configHeartBeatDelay = (heartBeatDelayInSeconds || 15) * 1000; // if a tracking request has already been sent, start the heart beat timeout if (lastTrackerRequestTime !== null) { setUpHeartBeat(); } },*/ /**/ /** * Clear heartbeat. */ /*REMOVING DEBUG METHODS disableHeartBeatTimer: function () { heartBeatDown(); configHeartBeatDelay = null; window.removeEventListener('focus', heartBeatOnFocus); window.removeEventListener('blur', heartBeatOnBlur); },*/ /**/ /** * Frame buster */ /*REMOVING METHODS WE WILL NOT SUPPORT killFrame: function () { if (windowAlias.location !== windowAlias.top.location) { windowAlias.top.location = windowAlias.location; } },*/ /** * Redirect if browsing offline (aka file: buster) * * @param string url Redirect to this URL */ /*REMOVING METHODS WE WILL NOT SUPPORT redirectFile: function (url) { if (windowAlias.location.protocol === 'file:') { windowAlias.location = url; } },*/ /** * Count sites in pre-rendered state * * @param bool enable If true, track when in pre-rendered state */ /*REMOVING METHODS WE WILL NOT SUPPORT setCountPreRendered: function (enable) { configCountPreRendered = enable; },*/ /** * Trigger a goal * * @param int|string idGoal * @param int|float customRevenue * @param mixed customData */ /*REMOVING METHODS WE WILL NOT SUPPORT trackGoal: function (idGoal, customRevenue, customData) { trackCallback(function () { logGoal(idGoal, customRevenue, customData); }); },*/ /** * Manually log a click from your own code * * @param string sourceUrl * @param string linkType * @param mixed customData * @param function callback */ /*REMOVING METHODS WE WILL NOT SUPPORT trackLink: function (sourceUrl, linkType, customData, callback) { trackCallback(function () { logLink(sourceUrl, linkType, customData, callback); }); },*/ /** * Log visit to this page * * @param string customTitle * @param mixed customData */ trackPageView: function (customTitle, customData) { trackedContentImpressions = []; if (isOverlaySession(configTrackerSiteId)) { trackCallback(function () { injectOverlayScripts(configTrackerUrl, configApiUrl, configTrackerSiteId); }); } else { trackCallback(function () { logPageView(customTitle, customData); }); } }, /** * Scans the entire DOM for all content blocks and tracks all impressions once the DOM ready event has * been triggered. * * If you only want to track visible content impressions have a look at `trackVisibleContentImpressions()`. * We do not track an impression of the same content block twice if you call this method multiple times * unless `trackPageView()` is called meanwhile. This is useful for single page applications. */ /*REMOVING METHODS WE WILL NOT SUPPORT trackAllContentImpressions: function () { if (isOverlaySession(configTrackerSiteId)) { return;