/* * tracker.js * Author: Adam Bratt * Version: 0.1 * Date: September 15, 2014 * Description: * * Allows Marketfy.com Mavens to track sales originating from their personal * sites and promotional landing pages. * */ MarketfyToolkit = window.MarketfyToolkit || {}; MarketfyToolkit.version = '0.3.1'; /** * Instantaneously invoked function to wrap tracker script. We bind the * tracker creation to the MarketfyToolkit global at the end of the invocation. * * To use on a page call: * MarketfyToolkit.startSession({code: 'ref_code'}); * * @param {window} window * @param {document} document * @param {MarketfyToolkit) toolkit Global instance of our Marketfy Toolkit * */ !function(window, document, toolkit, undefined) { // Check to see if already loaded this script if (toolkit.sessionTracker) return; /** * Marketfy Session Tracker Class for handling all types of session tracking * on external partner websites. * * @param {object} options Settings overrides for the class * @constructor * */ var Tracker = function (options) { this.init(options); }; Tracker.prototype = (function () { // Private static scope var cls = Tracker; var defaultSettings = { domain: 'marketfy.com', trackerEndpoint: '/api/v2/store/track-session/' }; var instanceCount = 0; /** * Loads a JSONP script asynchronously * @param {string} url URL of the script to load * @return {obj} DOM object for generated