// +------------------------------------------------------------+ // | CLASSES | // +------------------------------------------------------------+ function _t_ct_pt(id, sdid, aid) { this.version = 'v2'; this.id = id; this.sdid = sdid; this.aid = aid; this.key = null; this.referer = encodeURIComponent(window.location.href); this.ctutn = null; this.ctutv = null; this.tpid = null; this.rcs_l = null; this.rcs_t = null; this.rcs_d = null; this.rcs_i = null; // Complex pixel values. this.action_type = null; this.initial_fire_delay = null; this.num_fires_per_view = null; this.fire_repeat_sleep = null; this.total_num_fired = null; // +----------------+ // | Public Methods | // +----------------+ this.get_page_view_tracker = function() { return this._get_tracking_base_url() + 't.gif' + '?c=' + this.id + '&r=' + this.referer + '&s=1' + '&a=' + this.aid + this._get_ctu_qs() + this._get_tpid_qs() + this._get_rcs_qs(); }; this.set_rcs = function(l, t, d, i) { this.rcs_l = encodeURIComponent(l); this.rcs_i = encodeURIComponent(i); this.rcs_t = t; if (t.length > 100) { this.rcs_t = t.substr(0, 97) + '...'; } this.rcs_d = d; if (d.length > 250) { this.rcs_d = d.substr(0, 247) + '...'; } this.rcs_t = encodeURIComponent(this.rcs_t); this.rcs_d = encodeURIComponent(this.rcs_d); }; this.set_tpid = function(tpid) { this.tpid = encodeURIComponent(tpid); }; this.set_complex_fire_values = function(action_type, initial_fire_delay, num_fires_per_view, fire_repeat_sleep) { this.action_type = action_type; this.initial_fire_delay = initial_fire_delay; this.num_fires_per_view = num_fires_per_view; this.fire_repeat_sleep = fire_repeat_sleep; this.total_num_fired = 0; } this.track_action_complex = function() { var inst = this; if (this.action_type === 'delayed' && this.total_num_fired === 0) { setTimeout(function() { inst.track_action(); }, this.initial_fire_delay * 1000); return; } else if (this.action_type === 'repetitive') { if (this.total_num_fired === 0) { setTimeout(function() { inst.track_action(); }, this.initial_fire_delay * 1000); } else if (this.total_num_fired <= this.num_fires_per_view) { setTimeout(function() { inst.track_action(); }, this.fire_repeat_sleep * 1000); } } } this.is_complex = function () { return this.action_type === 'delayed' || this.action_type === 'repetitive'; } this.track_action = function() { if (this.is_complex() && this.total_num_fired === this.num_fires_per_view) { return; } var img; img = document.createElement('img'); img.id = 'tpv'; img.width = '1'; img.height = '1'; img.src = this._cache_bust(this.get_page_view_tracker()); img.alt = ''; document.body.appendChild(img); this.total_num_fired++; if (this.is_complex()) { this.track_action_complex(); } }; // +-----------------+ // | Private Methods | // +-----------------+ this._cache_bust = function(url) { return this._url_adjoin_qs(url, { api_z : Math.random() }); }; this._cast_to_string = function(a) { if (typeof a == 'boolean') { return a ? '1' : '0'; } if (typeof a == 'object' && !a) { return ''; } return encodeURIComponent('' + a); }; this._get_ctu_qs = function() { var qs; qs = ''; if (this.ctutn != null && this.ctutv != null) { qs = '&' + this.ctutn + '=' + this.ctutv; } return qs; }; this._get_env_prefix = function() { switch (this.sdid) { case 1: return 'local-'; case 2: return 'qa-'; case 4: return 'staging-'; default: return ''; } }; this._get_env_name = function() { switch (this.sdid) { case 1: return 'local'; case 2: return 'qa'; case 4: return 'staging'; default: return 'prod'; } } this._get_rcs_qs = function() { var qs; qs = ''; if (this.rcs_l != null && this.rcs_t != null && this.rcs_d != null) { qs = '&rcs_l=' + this.rcs_l + '&rcs_t=' + this.rcs_t + '&rcs_d=' + this.rcs_d + '&rcs_i=' + this.rcs_i; } return qs; }; this._get_tpid_qs = function() { var qs; qs = ''; if (this.tpid != null && this.tpid.length > 0) { qs = '&tpid=' + this.tpid; } return qs; }; this._get_tracking_base_url = function() { return document.location.protocol + '//' + this._get_env_prefix() + 't.crowdtwist.com/' + this.version + '/'; }; this._url_adjoin_qs = function(url, table) { var parts = url.split('?'); var vars = []; if (parts.length == 2) { var name_value_pairs = parts[1].split('&'); for (var i = 0; i < name_value_pairs.length; i++) { var name = name_value_pairs[i].split('=')[0]; if (name && !table.hasOwnProperty(name)) { vars.push(name_value_pairs[i]); } } } for (var key in table) { vars.push(key + '=' + this._cast_to_string(table[key])); } return parts[0] + '?' + vars.join('&'); }; }; // +------------------------------------------------------------+ // | CLIENT FUNCTIONS | // +------------------------------------------------------------+ /** * Rendered: 2015-11-03 17:25:44 * Site ID: 2 * Client ID: 20 * Cachebuster: 1 * Num. Actions: 17 */ /** * Action name: Joined Motor Trend Email * Action created: 2013-10-01 17:39:57 */ function ct_trck_joined_motor_trend_email(options) { try { var t = new _t_ct_pt('2-20', 3, 261); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Read Article * Action created: 2012-04-25 00:00:00 */ function ct_trck_article(options) { try { var t = new _t_ct_pt('2-20', 3, 66); t.set_complex_fire_values('delayed', 30, 5, null); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action_complex(); } catch (err) {} } /** * Action name: Signed Up for NCL Email * Action created: 2013-11-19 11:37:45 */ function ct_trck_signed_up_for_ncl_email(options) { try { var t = new _t_ct_pt('2-20', 3, 274); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Signed Up to Receive 2013 Home Game Schedule * Action created: 2013-04-17 15:56:01 */ function ct_trck_signed_up_to_receive_2013_schedule(options) { try { var t = new _t_ct_pt('2-20', 3, 202); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Subscribed to SeaWorld Email List * Action created: 2013-06-24 09:55:36 */ function ct_trck_subscribed_to_seaworld_email_list(options) { try { var t = new _t_ct_pt('2-20', 3, 221); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Viewed Photos * Action created: 2012-04-25 00:00:00 */ function ct_trck_photos(options) { try { var t = new _t_ct_pt('2-20', 3, 68); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Visited Finsiders Video * Action created: 2014-02-10 11:32:45 */ function ct_trck_visited_finsiders_video_dolphins(options) { try { var t = new _t_ct_pt('2-20', 3, 306); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Visited Fresh Meal Plan * Action created: 2013-11-06 12:06:18 */ function ct_trck_visited_fresh_meal_plan(options) { try { var t = new _t_ct_pt('2-20', 3, 272); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Visited Motor Trend Site * Action created: 2013-10-01 17:39:57 */ function ct_trck_visited_motor_trend_site(options) { try { var t = new _t_ct_pt('2-20', 3, 262); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Visited NCL Site * Action created: 2013-11-19 11:36:14 */ function ct_trck_visited_ncl_site(options) { try { var t = new _t_ct_pt('2-20', 3, 273); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Visited Shula Golf * Action created: 2013-10-01 17:39:57 */ function ct_trck_visited_shula_golf(options) { try { var t = new _t_ct_pt('2-20', 3, 264); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Visited Shula Hotel Site * Action created: 2013-10-01 17:39:57 */ function ct_trck_visited_shula_hotel_site(options) { try { var t = new _t_ct_pt('2-20', 3, 263); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Visited Site * Action created: 2012-04-25 00:00:00 */ function ct_trck_site(options) { try { var t = new _t_ct_pt('2-20', 3, 67); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Visited South Florida Ford * Action created: 2014-02-26 15:14:11 */ function ct_trck_visited_south_florida_ford(options) { try { var t = new _t_ct_pt('2-20', 3, 315); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Visited Sun Life WakeUp Page * Action created: 2013-06-24 09:55:36 */ function ct_trck_visited_sun_life_wakup_page(options) { try { var t = new _t_ct_pt('2-20', 3, 220); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Visited Under Armour * Action created: 2014-01-28 14:29:58 */ function ct_trck_visited_under_armour(options) { try { var t = new _t_ct_pt('2-20', 3, 305); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} } /** * Action name: Watched a Video * Action created: 2013-07-18 13:43:58 */ function ct_trck_video(options) { try { var t = new _t_ct_pt('2-20', 3, 233); t.set_tpid((options.content_identifier ? options.content_identifier : '')); if (options.link && options.title && options.desc) { t.set_rcs(options.link, options.title, options.desc, (options.image ? options.image : null)); } t.track_action(); } catch (err) {} }