PageSourceSearch

https://www.ctgoodjobs.hk/js/code/action_log_ajax.js

js ctgoodjobs.hk collected 2026-09-24 09:27:25 UTC 7,104 bytes, 225 lines download raw bytes

1function insertActionLogAjax(varAction, varRegion, varBanner_name, varId, varId2) {
2	
3	if (varId2 === undefined) {
4		varId2 = ''; // default value
5	}
6	if (varId == '') {
7		/*
8		_gaq.push(
9		['_trackEvent', varBanner_name, varRegion, window.location.href],
10		['secondTracker._trackEvent', varBanner_name, varRegion, window.location.href]
11		);
12		*/
13		//ga('send', 'event', varBanner_name, varRegion, window.location.href);
14		if (varBanner_name == 'apply-now-url') {
15			
16			if ($.cookie('tmpjobdetailclickid'))
17				temp_id = 'u'+$.cookie('tmpjobdetailclickid');
18			else
19				temp_id = '';
20			
21			gtag('event', 'apply_job', {'send_to': 'G-MXTQL33ENQ', 'applyjobmode': 'apply-now-url', 'refid': temp_id});
22			gtag('event', 'purchase', {'send_to': 'G-MXTQL33ENQ', 'transaction_id': temp_id, 'item_id': ''});
23		}
24		else if (varBanner_name == 'whatsapp-employer') {
25			
26			temp_id = 'w'+Date.now().toString();
27			
28			gtag('event', 'apply_job', {'send_to': 'G-MXTQL33ENQ', 'applyjobmode': 'whatsapp-btn-apply', 'refid': temp_id});
29			gtag('event', 'purchase', {'send_to': 'G-MXTQL33ENQ', 'transaction_id': temp_id, 'item_id': ''});
30		}
31		else if (isValidGAEvent(varBanner_name))
32			gtag('event', varBanner_name, {'send_to': 'G-MXTQL33ENQ'});					
33		
34	} else {
35		/*
36		_gaq.push(
37		['_trackEvent', varBanner_name+'_'+varId, varRegion, window.location.href],
38		['secondTracker._trackEvent', varBanner_name+'_'+varId, varRegion, window.location.href]
39		);
40		*/
41		//ga('send', 'event', varBanner_name + '_' + varId, varRegion, window.location.href);
42		if (varBanner_name == 'apply-now-url') {
43			
44			if ($.cookie('tmpjobdetailclickid'))
45				temp_id = 'u'+$.cookie('tmpjobdetailclickid');
46			else
47				temp_id = '';
48			
49			gtag('event', 'apply_job', {'send_to': 'G-MXTQL33ENQ', 'applyjobmode': 'apply-now-url', 'jobid': varId, 'refid': temp_id});
50			gtag('event', 'purchase', {'send_to': 'G-MXTQL33ENQ', 'transaction_id': temp_id, 'item_id': varId});
51		}
52		else if (varBanner_name == 'whatsapp-employer') {
53			
54			temp_id = 'w'+Date.now().toString();
55			
56			gtag('event', 'apply_job', {'send_to': 'G-MXTQL33ENQ', 'applyjobmode': 'whatsapp-btn-apply', 'jobid': varId, 'refid': temp_id});
57			gtag('event', 'purchase', {'send_to': 'G-MXTQL33ENQ', 'transaction_id': temp_id, 'item_id': varId});
58		}
59		else if (isValidGAEvent(varBanner_name))
60			gtag('event', varBanner_name, {'send_to': 'G-MXTQL33ENQ'});
61				
62	}
63
64	$.ajax({
65		url: "/include/action_log_insert.asp",
66		type: "GET",
67		data: {
68			action: varAction,
69			region: varRegion,
70			banner_name: varBanner_name,
71			id: varId,
72			id2: varId2,
73			my_url: window.location.pathname
74		},
75		dataType: 'json',
76		async: false,
77		cache: false,
78		timeout: 8000,
79		complete: function() {
80			return true;
81		},
82		error: function() {
83			return false;
84		}
85	});
86}
87
88function insertNewsExtUrl(varBanner_name) {
89	$.ajax({
90		url: "/include/news_ext_url_insert.asp",
91		type: "GET",
92		data: {
93			banner_name: varBanner_name
94		},
95		dataType: 'json',
96		async: false,
97		cache: false,
98		timeout: 8000,
99		complete: function() {
100			return true;
101		},
102		error: function() {
103			return false;
104		}
105	});
106}
107
108function insertArticleNewsLog(varId, varCatId, varType, varAction, varSource, varTargetUrl, varVal, varSection) {
109    var myUrl;
110    if (varAction == "click") {
111        myUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
112    }
113    if (varTargetUrl) {
114        if (varTargetUrl.charAt(0) == "/") {
115            varTargetUrl = window.location.protocol + "//" + window.location.host + varTargetUrl;
116        }
117        varTargetUrl = decodeURIComponent(varTargetUrl).replace('&', "%26");
118    }
119
120	if (varVal == '') {
121		//ga('send', 'event', varSection, varType, window.location.href);
122		gtag('event', varSection+varType+varId, {'send_to': 'G-MXTQL33ENQ'});		
123	} else {
124		//ga('send', 'event', varSection + '_' + varVal, varType, window.location.href);
125		gtag('event', varSection+varType+varId, {'send_to': 'G-MXTQL33ENQ'});		
126	}
127    $.ajax({
128        type: 'POST',
129        url: '/include/resources/article_news_log_insert.asp',
130        dataType: "json",
131        data: {
132            id: 		varId,
133            cid: 		varCatId,
134            type: 		varType,
135            action: 	varAction,
136			source:		varSource,
137            fromUrl: 	myUrl,
138            targetUrl: 	varTargetUrl,
139            val: 		varVal,
140			section:	varSection
141        },
142        async: false,
143        cache: false,
144        timeout: 8000,
145        complete: function () {
146            return true;
147        },
148        error: function () {
149            return false;
150        }
151    });
152}
153
154
155function isValidGAEvent(my_event_name) {
156	
157	if (my_event_name.indexOf('detail-image') == 0) 
158		return true;
159	else if (my_event_name.indexOf('homepage') == 0) 
160		return true;
161	else if (my_event_name.indexOf('quick-search') == 0)
162		return true;
163	else if (my_event_name.indexOf('apply_job') == 0)
164		return true;
165	else if (my_event_name.indexOf('login') == 0)
166		return true;
167	else if (my_event_name.indexOf('purchase') == 0)
168		return true;
169	else if (my_event_name.indexOf('regular-apply-user-15-plus') == 0)
170		return true;
171	else if (my_event_name.indexOf('regular-apply-user-5-plus') == 0)
172		return true;
173	else if (my_event_name.indexOf('photoswipe-pass-25') == 0)
174		return true;
175	else if (my_event_name.indexOf('photoswipe-pass-50') == 0)
176		return true;
177	else if (my_event_name.indexOf('photoswipe-pass-75') == 0)
178		return true;
179	else if (my_event_name.indexOf('photoswipe-pass-100') == 0)
180		return true;
181	else if (my_event_name.indexOf('photoswipe-first-art') == 0)
182		return true;
183	else
184		return false;
185}
186
187// function insertArtActionLogAjax(action, artType, source, section, toUrl, val) {
188	// var artID = "",
189		// catID = "",
190		// myURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
191	// if (source === undefined || source == "") {
192		// source = 'CT';
193	// }
194	// if (typeof objArt !== "undefined") {
195		// if (objArt.hasOwnProperty("id")) {
196			// artID = objArt.id;
197		// }
198		// if (objArt.hasOwnProperty("category_id")) {
199			// catID = objArt.category_id;
200		// }
201		// if (objArt.hasOwnProperty("source") && objArt.source) {
202			// source = objArt.source;
203		// }
204	// }
205
206	// if(toUrl.charAt(0) == "/") {
207		// toUrl = window.location.protocol + "//" + window.location.host + toUrl;
208	// }
209	// toUrl = decodeURIComponent(toUrl).replace('&', "%26");	 
210	// $.ajax({
211		// url: "/include/art_news_log_insert.asp?artid=" + artID + "&catid=" + catID + "&action=" + action + "&arttype=" + artType + "&source=" + source + "&section=" + section + "&tourl=" + toUrl + "&val=" + val + "&myurl=" + decodeURIComponent(myURL).replace('&', "%26"),
212		// type: "GET",
213		// data: {},
214		// dataType: 'json',
215		// async: false,
216		// cache: false,
217		// timeout: 8000,
218		// complete: function() {		
219			// return true;
220		// },
221		// error: function() {
222			// return false;
223		// }
224	// });
225// }

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.