PageSourceSearch

https://unicarshonda.com/wp-content/themes/shopperexpress/assets/old/js/asc-intice-tool-intake.js?ver=2.0.99

js unicarshonda.com collected 2026-09-29 16:38:06 UTC 5,853 bytes, 220 lines download raw bytes

1(function () {
2	'use strict';
3
4	if (window.__ascInticeIntakeBooted) return;
5	window.__ascInticeIntakeBooted = true;
6
7	console.log('🚀 ASC INTICE INTAKE LAYER INIT');
8
9	var approvedAscEventHints = [
10		'asc_retail_process',
11		'asc_cta_interaction',
12		'asc_form_engagement',
13		'asc_form_submission',
14		'asc_special_offer',
15		'asc_media_interaction'
16	];
17
18	var approvedToolNames = [
19		'leadmaker',
20		'trademaker',
21		'dealmaker',
22		'loanmaker'
23	];
24
25	var approvedInticeOrigins = [
26		'https://app.intice.com',
27		'https://tools.inticeinc.com',
28		'https://tools.inticeinc.net',
29		'https://cdn.intice.com',
30		'https://my-dealmaker.com',
31		'https://gettradevalue.com',
32		'https://my-loanmaker.com'
33	];
34
35	function isValidInticeToolEvent(data) {
36		return data &&
37			data.source === 'intice_tool' &&
38			data.schema_version === '1.0' &&
39			typeof data.tool_name === 'string' &&
40			typeof data.event === 'string';
41			//approvedToolNames.indexOf(data.tool_name) !== -1 &&
42			//approvedAscEventHints.indexOf(data.asc_event_hint) !== -1;
43	}
44
45	function isValidOrigin(origin) {
46		if (!origin) return false;
47		return approvedInticeOrigins.indexOf(origin) !== -1;
48	}
49
50	function normalizeToolEventToAsc(data) {
51		return {
52			event: data.event,
53			source: 'intice_tool',
54			schema_version: data.schema_version,
55			emitted_at: data.emitted_at || new Date().toISOString(),
56
57			tool_name: data.tool_name,
58			tool_instance_id: data.tool_instance_id || '',
59			tool_session_id: data.tool_session_id || '',
60
61			flow_name: data.flow_name || '',
62			flow_stage: data.flow_stage || '',
63			flow_outcome: data.flow_outcome || '',
64
65			tool_page: data.tool_page || '',
66			tool_page_name: data.tool_page_name || '',
67			tool_step: data.tool_step || '',
68
69			element_text: data.element_text || '',
70			element_type: data.element_type || '',
71			element_title: data.element_title || '',
72			event_action: data.event_action || '',
73			event_action_result: data.event_action_result || '',
74
75			media_type: data.media_type || '',
76			creative_name: data.creative_name || '',
77
78			payload: data.payload || {}
79		};
80	}
81
82	function enrichToolAscEvent(ascEvent) {
83		var base = (window.asc_datalayer && window.asc_datalayer[0]) || {};
84
85		// prevent recursive structures
86		var safeBase = Object.assign({}, base);
87
88		delete safeBase.events;
89
90		return Object.assign({}, safeBase, ascEvent, {
91			department: ascEvent.department || safeBase.department || 'sales',
92			page_type: ascEvent.page_type || safeBase.page_type || '',
93			items: ascEvent.items || safeBase.items || []
94		});
95	}
96
97	function dispatchAscEvent(enrichedEvent) {
98		console.log('📤 ASC EVENT PUSH:', enrichedEvent);
99
100		window.asc_datalayer = window.asc_datalayer || [];
101		window.asc_datalayer[0] = window.asc_datalayer[0] || {};
102		window.asc_datalayer[0].events = window.asc_datalayer[0].events || [];
103
104		window.asc_datalayer[0].events.push(enrichedEvent);
105		if (window.asc_datalayer[0].events.length > 100) {
106			window.asc_datalayer[0].events = window.asc_datalayer[0].events.slice(-100);
107		}
108
109		if (typeof gtag === 'function') {
110			console.log('📡 SENT TO GA4');
111			gtag('event', enrichedEvent.event, enrichedEvent);
112		}
113
114		if (typeof window.ascPublishEvent === 'function') {
115			window.ascPublishEvent(enrichedEvent);
116		}
117	}
118
119	function saveToInticeVueEventStore(eventData) {
120		var key = 'inticevue_events';
121		var existing = [];
122
123		try {
124			existing = JSON.parse(localStorage.getItem(key)) || [];
125		} catch (e) {}
126
127		existing.push({
128			event: eventData.event,
129			tool_name: eventData.tool_name || '',
130			flow_name: eventData.flow_name || '',
131			flow_stage: eventData.flow_stage || '',
132			flow_outcome: eventData.flow_outcome || '',
133			event_action_result: eventData.event_action_result || '',
134			page_type: eventData.page_type || '',
135			department: eventData.department || '',
136			timestamp: new Date().toISOString()
137		});
138
139		localStorage.setItem(key, JSON.stringify(existing.slice(-100)));
140
141		console.log('💾 STORED IN inticevue_events');
142	}
143
144	function processToolEvent(data) {
145		console.log('🟡 STANDARD TOOL EVENT DETECTED');
146
147		var ascEvent = normalizeToolEventToAsc(data);
148
149		console.log('🔧 NORMALIZED TOOL EVENT:', ascEvent);
150
151		var enrichedEvent = enrichToolAscEvent(ascEvent);
152
153		console.log('🚀 ENRICHED EVENT:', enrichedEvent);
154
155		dispatchAscEvent(enrichedEvent);
156		saveToInticeVueEventStore(enrichedEvent);
157	}
158
159	function processCustomerInfoEvent(params) {
160		var ascEvent = {
161			event: 'asc_tool_customer_info_capture',
162			source: 'intice_tool',
163			tool_name: 'customer_info',
164			event_action_result: 'capture',
165			element_text: 'customer_info_form',
166			element_type: 'lead_capture',
167			flow_stage: 'lead_capture',
168			payload: {
169				firstName: params.firstName || '',
170				lastName: params.lastName || '',
171				email: params.email || '',
172				phoneNo: params.phoneNo || ''
173			}
174		};
175
176		console.log('🚀 CUSTOMER INFO NORMALIZED:', ascEvent);
177
178		var enrichedEvent = enrichToolAscEvent(ascEvent);
179
180		console.log('🚀 ENRICHED EVENT:', enrichedEvent);
181
182		dispatchAscEvent(enrichedEvent);
183		saveToInticeVueEventStore(enrichedEvent);
184	}
185
186	function handleInticeToolMessage(event) {
187		var data = event.data;
188
189		if (!data || typeof data !== 'object') return;
190
191		console.log('📩 INTICE MESSAGE RECEIVED:', data);
192
193		if (event.origin) {
194			console.log('🌐 ORIGIN:', event.origin, {
195				valid: isValidOrigin(event.origin)
196			});
197		}
198
199		if (data.source === 'intice_tool') {
200			console.log(data);
201			if (!isValidInticeToolEvent(data)) {
202				console.log('⛔ INVALID TOOL EVENT', { tool_name: data.tool_name, asc_event_hint: data.asc_event_hint });
203			//	return;
204			}
205
206			processToolEvent(data);
207			return;
208		}
209
210		if (data.message === 'customerInfo') {
211			console.log('🟢 CUSTOMER INFO EVENT DETECTED');
212			processCustomerInfoEvent(data.params || {});
213			return;
214		}
215
216	}
217
218	window.addEventListener('message', handleInticeToolMessage);
219
220}());

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.