PageSourceSearch

https://rickeysmileymorningshow.com/wp-content/plugins/ione-module…/js/ione-ad-utils.js?ver=9617fb2

js rickeysmileymorningshow.com collected 2026-09-24 17:35:07 UTC 3,258 bytes, 124 lines download raw bytes

1/* global adUtilsHelper */
2( function() {
3	var referrerCookie, referrerDomain, siteDomain;
4	var referrer = '';
5	var countValue = 0;
6	var utmData = {};
7	var allowedUTMs = ['utm_source', 'utm_medium', 'utm_term', 'utm_content', 'utm_campaign'];
8	var cookieName = 'ione_viewcount';
9	var cookieData, vars;
10
11	window.ioneAdUtils = {
12		getEnvironment: function() {
13			const hostname = document.location.hostname;
14			if ( /(^|\.)ione\.nyc$/.test( hostname ) ) {
15				return 'stage';
16			}
17			return 'production';
18		},
19		readCookie: function( name ) {
20			var nameEQ = name + '=';
21			var ca = document.cookie.split( ';' );
22			var i, c;
23
24			for ( i = 0; i < ca.length; i++ ) {
25				c = ca[i];
26				while ( ' ' === c.charAt( 0 ) ) {
27					c = c.substring( 1, c.length );
28				}
29				if ( 0 === c.indexOf( nameEQ ) ) {
30					return c.substring( nameEQ.length, c.length );
31				}
32			}
33			return null;
34		},
35		createCookie: function( name, value, hours ) {
36			let date, cookie;
37			let expires = '';
38			if ( hours ) {
39				date = new Date();
40				date.setTime( date.getTime() + ( hours * 60 * 60 * 1000 ) );
41				expires = '; expires=' + date.toGMTString();
42			}
43			cookie = `${ name }=${ value }${ expires }; path=/`;
44			document.cookie = cookie;
45		},
46		eraseCookie: function( name ) {
47			this.createCookie( name, '', -1 );
48		},
49		getQueryVars: function() {
50			var string = window.location.href;
51			var vars = {};
52			var hash = [];
53			var i, hashes;
54
55			if ( -1 === string.search( /\?/i ) ) {
56				return [];
57			}
58
59			// Store GET params as vars[]
60			hashes = string.slice( string.indexOf( '?' ) + 1 ).split( '&' );
61			for ( i = 0; i < hashes.length; i++ ) {
62				hash = hashes[i].split( '=' );
63				vars[hash[0]] = hash[1];
64			}
65			return vars;
66		},
67		viewCount: function() {
68			return countValue;
69		},
70		getUTM: function( key ) {
71			if ( 'undefined' === typeof utmData[key] ) {
72				return '';
73			}
74
75			return utmData[key];
76		},
77		getReferrer: function() {
78			return referrer;
79		}
80	};
81
82	function getDomain( url ) {
83		const element = document.createElement( 'a' );
84		element.href = url;
85		return element.hostname;
86	}
87
88	// Init UTM data
89	cookieData = JSON.parse( window.ioneAdUtils.readCookie( 'utm_cookie' ) );
90	if ( null === cookieData || 0 === Object.keys( cookieData ).length ) {
91		vars = window.ioneAdUtils.getQueryVars();
92		allowedUTMs.forEach( function( element ) {
93			if ( 'undefined' !== typeof vars[ element ] ) {
94				utmData[ element ] = vars[ element ];
95			}
96		} );
97		window.ioneAdUtils.createCookie( 'utm_cookie', JSON.stringify( utmData ), 0.5 );
98	} else {
99		utmData = cookieData;
100	}
101
102	// Init Count Value
103	countValue = parseInt( window.ioneAdUtils.readCookie( cookieName ) );
104	if ( isNaN( countValue ) ) {
105		countValue = 0;
106	} else {
107		countValue++;
108	}
109	window.ioneAdUtils.createCookie( cookieName, encodeURIComponent( countValue ), 0.5 );
110
111	// Init Referrer data
112	referrerCookie = window.ioneAdUtils.readCookie( 'referrer_cookie' );
113	if ( null === referrerCookie ) {
114		referrerDomain = getDomain( window.document.referrer );
115		siteDomain = getDomain( adUtilsHelper.home_url );
116
117		if ( siteDomain !== referrerDomain ) {
118			referrer = referrerDomain;
119			window.ioneAdUtils.createCookie( 'referrer_cookie', referrer, 0.5 );
120		}
121	} else {
122		referrer = referrerCookie;
123	}
124}() );

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.