PageSourceSearch

https://www.westerndodge.ca/wp-content/mu-plugins/convertus-optimi…/init-optimizely-js-sdk.js?ver=1790040204

js westerndodge.ca collected 2026-09-29 01:05:40 UTC 1,437 bytes, 55 lines download raw bytes

1function getCookie( name ) {
2	return document.cookie
3		.split( ';' )
4		.map( row => row.trim() )
5		.find( row => row.startsWith( name + '=' ) )
6		?.split( '=' )[1];
7}
8
9const settleOptimizely = ( eventName, detail ) => {
10	globalThis.dispatchEvent( new CustomEvent( eventName, { detail }) );
11};
12
13const initializeOptimizely = () => {
14	if ( ! globalThis.optimizelyDataFile ) {
15		settleOptimizely( 'convertus:optimizely-error', new Error( 'Missing optimizelyDataFile' ) );
16		return;
17	}
18
19	if ( ! globalThis.optimizelySdk ) {
20		settleOptimizely( 'convertus:optimizely-error', new Error( 'Missing optimizelySdk' ) );
21		return;
22	}
23
24	let userId = getCookie( 'optimizely_user_id' );
25
26	if ( ! userId ) {
27
28		userId = Date.now() + '-' + Math.random().toString( 16 ).slice( 2 );
29
30		const maxAge = 60 * 60 * 24 * 180;
31
32		document.cookie = `optimizely_user_id=${userId};path=/;max-age=${maxAge};secure`;
33	}
34
35	try {
36		const optimizely = globalThis.optimizelySdk.createInstance({
37			datafile: globalThis.optimizelyDataFile,
38			eventBatchSize: 10,
39			eventFlushInterval: 1000
40		});
41
42		const attributes = {
43			domain: globalThis.location.hostname.toLowerCase()
44		};
45
46		const user = optimizely.createUserContext( userId, attributes );
47
48		settleOptimizely( 'convertus:optimizely-ready', { optimizely, user });
49	} catch ( e ) {
50		console.error( 'Optimizely init error', e );
51		settleOptimizely( 'convertus:optimizely-error', e );
52	}
53};
54
55initializeOptimizely();

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.