PageSourceSearch

https://assets.moncvparfait.fr/wp-content/themes/myperfectresume/js/newSegmentServer.js

js moncvparfait.fr collected 2026-10-05 04:10:46 UTC 6,564 bytes, 190 lines download raw bytes

1/*********segment code start***************/
2var urlParts = location.host.split('.');
3var ENV = '';
4var country = urlParts[urlParts.length-1];
5
6if (urlParts[0] == "www" || location.host == "wp" || urlParts[0] == "stg" || location.host == "stg-wp") {
7    ENV = 'prod';
8    var gakeylist = { "uk": "UA-98378845-3" , "es": "UA-98378845-7", "fr": "UA-98378845-5" ,"it": "UA-3289623-35","mx": "UA-98378845-7","br": "UA-98378845-9"};
9	var vsuidDimensionName = { "uk": "dimension1" , "es": "dimension1", "fr": "dimension1" ,"it": "dimension1","mx": "dimension1","br": "dimension1"};
10} else {
11    ENV = 'dev';
12    var gakeylist = { "uk": "UA-98378845-2" , "es": "UA-98378845-6", "fr": "UA-98378845-4" ,"it": "UA-98378845-10","mx": "UA-98378845-6","br": "UA-98378845-8"}; 
13	var vsuidDimensionName = { "uk": "dimension1" , "es": "dimension1", "fr": "dimension1" ,"it": "dimension1","mx": "dimension1","br": "dimension1"};
14}
15
16var consentCookie = localStorage.getItem('COOKIE_CONSENT');
17var objconsent = JSON.parse(consentCookie);
18var analyticsConsent = false;
19if(objconsent !=null){
20    analyticsConsent=objconsent["consent"]["analytics"];
21}
22else{
23    //console.log('set true');
24}
25
26if(analyticsConsent===true && typeof addCrazyEgg !== "undefined" && addCrazyEgg){
27    loadScript('//script.crazyegg.com/pages/scripts/0094/5784.js');
28}
29
30function readCookieVal(name) {
31	var nameEQ = name + "=";
32	var ca = document.cookie.split(';');
33	for (var i = 0; i < ca.length; i++) {
34		var c = ca[i];
35		while (c.charAt(0) == ' ')
36			c = c.substring(1, c.length);
37		if (c.indexOf(nameEQ) == 0)
38			return c.substring(nameEQ.length, c.length);
39	}
40}
41		
42
43function TrackEvents(eventname, eventpropval, userid, islogin) {
44    var propertiesToBeSent = CommonTrackProperties(islogin);
45    var eventproperties = {};
46
47    if (eventpropval) {
48        for (var item in eventpropval) {
49            if (eventpropval[item]) {
50                propertiesToBeSent['properties_'+item] = eventpropval[item];
51            }
52        }
53    }
54    propertiesToBeSent['event_name'] = eventname;
55    propertiesToBeSent['call_type'] = 'track';
56    propertiesToBeSent['event_name'] = eventname;
57    propertiesToBeSentString = param(propertiesToBeSent);
58    FireSegmentIOPageAndEvent(propertiesToBeSentString);
59}
60
61function TrackPageEvents(eventpropval, islogin) {
62    var propertiesToBeSent = CommonTrackProperties(islogin);
63
64    if (eventpropval) {
65        for (var item in eventpropval) {
66            if (eventpropval[item] && eventpropval[item] != '') {
67                propertiesToBeSent['properties_'+item] = eventpropval[item];
68            }
69        }
70    }
71    propertiesToBeSent['call_type'] = 'page';
72	propertiesToBeSentString = param(propertiesToBeSent);
73    FireSegmentIOPageAndEvent(propertiesToBeSentString);
74}
75
76function param(object) {
77    var encodedString = '';
78    for (var prop in object) {
79        if (object.hasOwnProperty(prop)) {
80            if (encodedString.length > 0) {
81                encodedString += '&';
82            }
83            encodedString += encodeURI(prop + '=' + object[prop]);
84        }
85    }
86    return encodedString;
87}
88
89
90function FireSegmentIOPageAndEvent(properties) {
91	xhr = new XMLHttpRequest();
92	xhr.open('POST', '/wp-content/ajax-call/v2.php',true);
93	xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
94	xhr.send(properties);
95}	
96
97function CommonTrackProperties(islogin) {
98    var vsuid = readCookieVal('vsuid');
99    var pageType = 'SEO';
100    var search = location.search;
101    if( configUrls.EXACT_ENV == undefined ){
102        pageType = 'SEM';
103    }
104    var propertiesToBeSent = {
105        'context_page_referrer': document.referrer,
106        'context_page_url': encodeURIComponent( document.URL ),
107        'context_user_agent': navigator.userAgent,
108        'context_page_title': document.title,
109        'context_screen_height': screen.height,
110        'context_screen_width': screen.width,
111        'context_search': encodeURIComponent( search ),
112        'properties_Login_Status': islogin,
113        'properties_path': window.location.pathname,
114        'properties_Platform': 'Web',
115        'properties_Portal': configUrls.SEGMENT_PORTAL,
116        'properties_device_type': userAgent(),
117        'properties_Page_Type': pageType,
118        'ENV': ENV,
119        'visitId': vsuid
120    };
121    return propertiesToBeSent;
122}
123
124strlogin = readCookieVal('UserStatus');
125if (strlogin != null) {
126    loginObj = JSON.parse(strlogin);
127    if (loginObj.IsUserLoggedIn === true) {
128        loginType = 'TRUE';
129    } else {
130        loginType = 'FALSE';
131    }
132} else {
133    loginType = 'FALSE';
134}
135
136var interval = setInterval(function () {
137    var vsuid = readCookieVal('vsuid');
138    if(!analyticsConsent){
139        var consentCookie = localStorage.getItem('COOKIE_CONSENT');
140        if (consentCookie) {
141            analyticsConsent = JSON.parse(consentCookie)["consent"]["analytics"];
142        }
143    }
144    if (vsuid != null && analyticsConsent== true) {
145        TrackPageEvents({
146            'visitId': vsuid,          
147        }, loginType);
148
149        // if( configUrls.GA_FLAG ){
150        //     /* GA code starts */
151        //     var gakey = gakeylist[country];
152        //     var visitorId = readCookieVal('vsuid');
153        //     (function (i, s, o, g, r, a, m) {
154        //         i['GoogleAnalyticsObject'] = r;
155        //         i[r] = i[r] || function () {
156        //             (i[r].q = i[r].q || []).push(arguments)
157        //         }, i[r].l = 1 * new Date();
158        //         a = s.createElement(o),
159        //                 m = s.getElementsByTagName(o)[0];
160        //         a.async = 1;
161        //         a.src = g;
162        //         m.parentNode.insertBefore(a, m)
163        //     })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
164
165        //     ga('create', gakey, 'auto', {'useAmpClientId': true});
166        //     ga('set', 'anonymizeIp', true);
167        //     ga('set', vsuidDimensionName[country] , visitorId);
168        //     ga('send', 'pageview');
169        //     /* GA code ends */
170        // }
171        clearInterval(interval);
172    }
173}, 50);
174/*********segment code end***************/
175
176/*********user agent start****************/
177function userAgent() {
178    var DeviceType;
179    if (navigator.userAgent.match(/iPad|Tablet|PlayBook/i))
180    {
181        DeviceType = 'tablet';
182    } else if (navigator.userAgent.match(/Mobile|Android|webOS|iPhone|iPod|Blackberry/i))
183    {
184        DeviceType = 'mobile';
185    } else {
186        DeviceType = 'desktop';
187    }
188    return DeviceType;
189} 
190/*********user agent end***************/

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.