PageSourceSearch

https://www.angelsense.com/wp-content/themes/angelsense/js/late-lo…/tracking-actions-load.js?v=146.7&ver=146.7

js angelsense.com collected 2026-09-24 10:09:19 UTC 18,354 bytes, 449 lines download raw bytes

1/**********************/
2/* Events starts here */
3/**********************/
4jQuery(document).ready(function () {
5    var currentURL = window.location.href;
6    var specificStrings = ["pricing", "checkout"];
7
8    function doesNotContainSpecificStrings(url, strings) {
9        for (var i = 0; i < strings.length; i++) {
10            if (url.indexOf(strings[i]) !== -1) {
11                return false; // URL contains at least one of the specific strings
12            }
13        }
14        return true; // URL does not contain any of the specific strings
15    }
16
17    if(doesNotContainSpecificStrings(currentURL, specificStrings)) {
18        var content_id = 'device';
19        if (currentURL.indexOf('teens-and-adults') !== -1
20            || currentURL.indexOf('gps-tracker-for-elderly') !== -1
21            || currentURL.indexOf('gps-tracker-watch') !== -1) {
22
23            content_id = 'watch';
24        }
25
26
27        /* Phase 3 (ticket #15499): use a UUID for event_id — the legacy
28         * 8-digit Math.random() collided across users and TikTok's dedup
29         * rate collapsed to ~14%. See doc/15499/TECH_SPEC.md §11. */
30        var event_id = (typeof asTtNewEventId === 'function')
31            ? asTtNewEventId()
32            : (Math.floor(Math.random() * (90000000 - 10000000 + 1)) + 10000000);
33        angelsense_setCookie("angelsense_tt_id", event_id);
34        angelsense_setCookie("angelsense_device", 'watch', 1);
35
36        if(window.ttq) {
37            /* Phase 2 (ticket #15499): identify with click-ids before track so
38             * TikTok can match this fire to a ttclid-attributed session. */
39            if (typeof asTtIdentifyIfKnown === 'function') { asTtIdentifyIfKnown(); }
40            var _ttViewContentPayload = {
41                'event_id': event_id,
42                'content_type': "product",
43                'content_id': content_id
44            };
45            if (typeof asTtWithClickIds === 'function') { asTtWithClickIds(_ttViewContentPayload); }
46            ttq.track('ViewContent', _ttViewContentPayload);
47        }
48
49        /* Ticket #15903: OpenAI Ads paired ViewContent fire. */
50        if (typeof asOaiMeasure === 'function') {
51            asOaiMeasure('contents_viewed', {
52                type: 'contents',
53                contents: [{ id: content_id, content_type: 'product' }]
54            }, event_id);
55        }
56    }
57
58
59    eventTracking.TrackEventLog('Page Loaded', {
60        'url': window.location.pathname,
61        'testVersion': angelsense_getCookie('angelsense_testing_version')
62    });
63
64    if(window.amzn) {
65        amzn("trackEvent", "PageView", {
66            'url': window.location.pathname
67        });
68    }
69
70    // Angelsense Logo
71
72    jQuery('body').on('click', '.header_content a.logo, header.mobile a.logo', function(event){
73        document.cookie = 'angelsense_source' + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
74        if(jQuery('body').hasClass('google-shopping')) {
75            event.preventDefault();
76        }
77        eventTracking.TrackEventLog('AngelSense Logo Click');
78    });
79
80    // Main menu links
81    jQuery('body').on('click', 'ul#menu-main a, ul#menu-mobile-menu a, ul#menu-agencies a', function(event) {
82        var data = {
83            'Menu Item': jQuery(this).text(),
84            "Destination URL": jQuery(this).attr('href'),
85            'testVersion': angelsense_getCookie('angelsense_testing_version')
86        };
87        console.log(jQuery(this).text());
88        eventTracking.TrackEventLog('Main Menu Links', data);
89    });
90
91    jQuery('body').on('click', 'ul#menu-login a', function(event) {
92        var data = {
93            'Menu Item': jQuery(this).text(),
94            "Destination URL": jQuery(this).attr('href'),
95            'testVersion': angelsense_getCookie('angelsense_testing_version')
96        };
97        console.log(jQuery(this).text());
98        eventTracking.TrackEventLog('Login Menu Links', data);
99    });
100
101// Checkout page phone number
102    jQuery('a[href*="tel"]').on('click', function(event) {
103        var locationOnPage = (jQuery(this).data('location')) ? jQuery(this).data('location') : ' ';
104        var origin = (jQuery(this).data('origin')) ? jQuery(this).data('origin') : 'page';
105
106        if(jQuery('body').hasClass('no-live-chat')) {
107            event.preventDefault();
108            /*Open Chat*/
109            LC_API.open_chat_window();
110            if(!isMobile.any()) {
111                jQuery('#chatRequest').removeClass('hide');
112            }
113            jQuery('#chat_popup').removeClass('show');
114
115            eventTracking.TrackEventLog('Phone Dialer Clicked', {
116                'url': window.location.pathname,
117                'origin': origin,
118                'locationOnPage': locationOnPage,
119                'workingHours': false
120            });
121        } else {
122            eventTracking.TrackEventLog('Phone Dialer Clicked', {
123                'url': window.location.pathname,
124                'origin': origin,
125                'locationOnPage': locationOnPage,
126                'workingHours': true
127            });
128        }
129    });
130
131    jQuery('a[class*="chat"]').on('click', function(event) {
132        console.log(jQuery(this).data('location'));
133        eventTracking.TrackEventLog('Chat link Clicked', {
134            'url': window.location.pathname,
135            'pageLocation': jQuery(this).data('location')
136        });
137    });
138
139    jQuery('body').on('click', '#menu-additional-mobile-menu a, #menu-additional-mobile-menu-1 a', function(event) {
140        var parentClass  = jQuery(this).parent().attr('class');
141        if(parentClass.includes('kids')) {
142            console.log("Has Kids Class");
143            angelsense_setCookie('angelsense_source', 'kids');
144        } else {
145            document.cookie = 'angelsense_source' + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
146        }
147        var data = {
148            'Menu Item': jQuery(this).text(),
149            "Destination URL": jQuery(this).attr('href')
150        };
151        eventTracking.TrackEventLog('Main Menu Mobile Fixed Links', data);
152    });
153
154
155    jQuery('#access').on('click', function() {
156        setTimeout(accessibility_menu, 2000);
157    })
158
159    function accessibility_menu() {
160        console.log('Entered');
161        var widgetClass = jQuery('.userway_p5').attr('class');
162
163        if(widgetClass.indexOf('uon') !== -1) {
164            console.log('Accessibility Menu Opened');
165            eventTracking.TrackEventLog('Accessibility Menu Opened', {
166                'url': window.location.pathname
167            });
168        }
169    }
170
171    // Order Now Links
172    jQuery('a[href="/pricing/"]').on('click', function(event) {
173        var section = '';
174        section = jQuery(this).data('position');
175        eventTracking.TrackEventLog('Order Now Button', {
176            'Anchor Text' : jQuery(this).text() ,
177            'Element ID' : jQuery(this).attr('id'),
178            'Element Class' : jQuery(this).attr('class') ,
179            'Section': section,
180            'url': window.location.href,
181            'testVersion': angelsense_getCookie('angelsense_testing_version')
182        });
183
184        /* Phase 3 (ticket #15499): mint the TikTok event_id and set the
185         * `angelsense_tt_id` cookie BEFORE the GA4 dataLayer.push, so the
186         * paired sGTM TikTok tag reads the same value as the browser fire.
187         * Previously the cookie was set after the push → dedup mismatch. */
188        var event_id = (typeof asTtNewEventId === 'function')
189            ? asTtNewEventId()
190            : (Math.floor(Math.random() * (90000000 - 10000000 + 1)) + 10000000);
191        angelsense_setCookie("angelsense_tt_id", event_id);
192        angelsense_setCookie("angelsense_device", 'device', 1);
193
194        dataLayer.push({
195            'event': 'HPCTA'
196        });
197
198        /*tiktok click button event*/
199        if(window.ttq) {
200
201            /* Phase 2 (ticket #15499): identify with click-ids before track. */
202            if (typeof asTtIdentifyIfKnown === 'function') { asTtIdentifyIfKnown(); }
203            var _ttClickBtnPayload = {
204                'event_id': event_id,
205                'content_type': "product",
206                'content_id': 'device'
207            };
208            if (typeof asTtWithClickIds === 'function') { asTtWithClickIds(_ttClickBtnPayload); }
209            ttq.track('ClickButton', _ttClickBtnPayload);
210        }
211
212        /* Ticket #15903: OpenAI Ads paired ClickButton (device) fire. */
213        if (typeof asOaiMeasure === 'function') {
214            asOaiMeasure('custom', {
215                type: 'contents',
216                custom_event_name: 'click_button',
217                contents: [{ id: 'device', content_type: 'product' }]
218            }, event_id);
219        }
220
221        if(window.amzn) {
222            amzn("trackEvent", "PricingVisit", {
223                'url': window.location.pathname
224            });
225        }
226    });
227
228    jQuery('a[href="/pricing/?device=watch"]').on('click', function(event) {
229        /* Phase 3 (ticket #15499): mint event_id + set cookie BEFORE
230         * dataLayer.push so sGTM reads the matching id. See sibling. */
231        var event_id = (typeof asTtNewEventId === 'function')
232            ? asTtNewEventId()
233            : (Math.floor(Math.random() * (90000000 - 10000000 + 1)) + 10000000);
234        angelsense_setCookie("angelsense_tt_id", event_id);
235        angelsense_setCookie("angelsense_device", 'watch', 1);
236
237        /*tiktok click button event*/
238        dataLayer.push({
239            'event': 'HPCTA'
240        });
241
242        if(window.ttq) {
243
244            /* Phase 2 (ticket #15499): identify with click-ids before track. */
245            if (typeof asTtIdentifyIfKnown === 'function') { asTtIdentifyIfKnown(); }
246            var _ttClickBtnWatchPayload = {
247                'event_id': event_id,
248                'content_type': "product",
249                'content_id': 'watch'
250            };
251            if (typeof asTtWithClickIds === 'function') { asTtWithClickIds(_ttClickBtnWatchPayload); }
252            ttq.track('ClickButton', _ttClickBtnWatchPayload);
253        }
254
255        /* Ticket #15903: OpenAI Ads paired ClickButton (watch) fire. */
256        if (typeof asOaiMeasure === 'function') {
257            asOaiMeasure('custom', {
258                type: 'contents',
259                custom_event_name: 'click_button',
260                contents: [{ id: 'watch', content_type: 'product' }]
261            }, event_id);
262        }
263    });
264
265    jQuery('a[href="/checkout/"]').on('click', function(event) {
266        eventTracking.TrackEventLog('Order Now Button', { 'Anchor Text' : jQuery(this).text(),'Element ID' : jQuery(this).attr('id'), 'Element Class' : jQuery(this).attr('class') } );
267    });
268
269    // Mobile Header Sticky Event
270    jQuery('#header-sticky').on('click', function(event) {
271        eventTracking.TrackEventLog('Mobile Header Sticky Click');
272    });
273
274
275    // Mobile Sticky Event
276    jQuery('a.sticky_banner').on('click', function(event) {
277        eventTracking.TrackEventLog('Mobile Sticky Click');
278    });
279
280    jQuery('div.mobile_sticky_banner a.order').on('click', function(event) {
281        eventTracking.TrackEventLog('Mobile Sticky Click');
282    });
283
284    // Sticky Banner
285    jQuery('div.sticky_expand a.redirect').on('click', function() {
286        eventTracking.TrackEventLog('Sticky Banner Click');
287    });
288
289    // Sticky Banner close
290    jQuery('div.sticky_expand a.close').on('click', function() {
291        eventTracking.TrackEventLog('Sticky Banner Remove');
292    });
293
294
295    //  Support Center Search
296    if (current_page_is("/help-search/") ){
297        eventTracking.TrackEventLog('Support Center Search Results Page Loaded', {
298            'name' : 'Support Center Search Results Page Loaded'
299        });
300    }
301
302    var searchInputInteracted = false;
303    jQuery('.ais-SearchBox-input').on('focus', function(){
304        if (!searchInputInteracted) {
305            eventTracking.TrackEventLog('Support Center Search Input Interacted', {});
306            searchInputInteracted = true;
307        }
308    });
309
310    // Footer Menu Links
311    jQuery('body').on('click', '.footer-navbar a', function(event) {
312        var data = {
313            'Menu Item': jQuery(this).text(),
314            'Destination URL': jQuery(this).attr('href')
315        };
316        eventTracking.TrackEventLog('Footer Menu Links', data);
317    });
318
319    // Footer Social Links
320    jQuery('div.last-footer-col a').on('click', function(event) {
321        eventTracking.TrackEventLog('Footer Social Links', {'Social Name': jQuery(this).attr('title')});
322    });
323
324    jQuery('#checkout_popup a.order').on('click', function() {
325        eventTracking.TrackEventLog('Popup Element', {
326            'Popup name': 'Discount'
327        });
328    });
329
330    jQuery('#checkout_popup a.remove').on('click', function() {
331        eventTracking.TrackEventLog('Popup Element Remove Button', {
332            'Popup name': 'Discount'
333        });
334    });
335
336
337    /* ********** */
338    /* Chat popup */
339    /* ********** */
340
341    var menuLinks = jQuery('div.step.menu a');
342    var open_button = jQuery('div#chatRequest');
343    var close_button = jQuery('div#chat_popup a.remove');
344    var guide_close_button = jQuery('div#guide_popup a.remove');
345    var checkout_popup_close_button = jQuery('div#checkout_popup a.remove');
346    var device = (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.
346substr(0,4))) ? 'Mobile' : 'Desktop';
347
348/*    jQuery('body').on('click', menuLinks, function(e){
349        var item = jQuery(this);
350        var option = item.data('chat');
351        var option_text = {"chat" : "Open Chat", "call" : "Open Dialer", "reply" : "Open Call Back"};
352
353        eventTracking.TrackEventLog('Chat Options Interaction', {
354            'Name' : option_text[option],
355            'Device' : device
356        });
357    })*/
358
359    open_button.on('click', function() {
360        eventTracking.TrackEventLog('Expand Chat Widget' , {
361            'Device' : device
362        });
363    });
364
365    jQuery('#phone_chat').on('click', function() {
366        eventTracking.TrackEventLog('Expand Chat Widget' , {
367            'Device' : device
368        });
369    });
370
371
372    close_button.on('click', function() {
373        eventTracking.TrackEventLog('Minimize Chat Widget' , {
374            'Device' : device
375        });
376    });
377
378
379    guide_close_button.on('click', function() {
380        eventTracking.TrackEventLog('Guide Popup Removed');
381    });
382
383    checkout_popup_close_button.on('click', function(){
384        eventTracking.TrackEventLog('Discount Popup', {
385            'Popup Removed' : true
386        });
387    });
388
389    //Safety Sticker Impression and signup events
390    if (window.location.href.indexOf("/sticker-lp/") > -1) {
391        var interval = setInterval(stickerSignup, 500);
392        console.log('Safety Sticker Impression');
393        eventTracking.TrackEventLog('Safety Sticker: Impression');
394    }
395
396
397    // New HP Events
398    jQuery('a.review').on('click', function() {
399        console.log('Herersdsds');
400        eventTracking.TrackEventLog('New HP: Parent Stories link');
401    });
402
403    jQuery('a.product').on('click', function() {
404        eventTracking.TrackEventLog('New HP: Explore All Features link');
405    });
406
407    jQuery('section.wearing').on('click', function() {
408        eventTracking.TrackEventLog('New HP: Sensory Friendly Video link');
409    });
410
411    let forced_hj = false;
412
413    jQuery('body').on('click', '.payment_method_stripe_applepay', function(){
414        gpayTracking('ApplePay Payment Method Radio Clicked', 'applepay_radio_click');
415    });
416    jQuery('body').on('click', '.payment_method_stripe_googlepay', function(){
417        gpayTracking('GooglePay Payment Method Radio Clicked', 'googlepay_radio_click');
418    });
419
420    jQuery('body').on('click', '.banner_payment_method_stripe_applepay button', function(){
421        gpayTracking('ApplePay Payment Button Clicked', 'applepay_button_click');
422    });
423
424    jQuery('body').on('click', '.banner_payment_method_stripe_googlepay button', function(){
425        gpayTracking('GooglePay Payment Button Clicked', 'googlepay_button_click');
426    });
427
428    function gpayTracking(event, hj_event){
429        eventTracking.TrackEventLog(event);
430        if(typeof hj != 'undefined'){
431            if (!forced_hj) {
432                hj('event', 'force_hj_record');
433                forced_hj = true;
434            }
435            hj('event', hj_event)
436        }
437    }
438
439});
440
441
442
443function stickerSignup() {
444    if(jQuery('#sticker-sign').hasClass('success')) {
445        console.log('Safety Sticker Signup');
446        eventTracking.TrackEventLog('Safety Sticker: Signup');
447        clearInterval(interval);
448    }
449}

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.