1var ga_result_item 2var ga_each_re 3var ga4_dimension_str 4 5// Start - GA4 6var gadict = {}; 7 8if (GAGlobalDimension[0] == null) { 9 gadict['content_group'] = getContentGroup(window.location.pathname); 10 11 var params = new URLSearchParams(window.location.search) 12 //params.delete('utm_source') 13 //params.delete('utm_medium') 14 //params.delete('utm_campaign') 15 params.delete('fbclid') 16 17 if (params.toString()) 18 gadict['page_location'] = decodeURIComponent(window.location.protocol + '//' + window.location.host + window.location.pathname + '?' + params.toString() + window.location.hash); 19 else 20 gadict['page_location'] = decodeURIComponent(window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.hash); 21 22} 23else { 24 if (GAGlobalDimension[0].indexOf(document.location.origin) < 0) 25 GAGlobalDimension[0] = document.location.origin + GAGlobalDimension[0]; 26 gadict['page_location'] = decodeURIComponent(GAGlobalDimension[0]); 27 gadict['content_group'] = getContentGroup(GAGlobalDimension[0].replace(/^.*\/\/[^\/]+/, '')); 28} 29//gadict['url'] = gadict['page_location']; 30content_group = gadict['content_group']; 31 32if (document.referrer != '') { 33 gadict['referrerurl'] = document.referrer; 34 gadict['referrercontentgroup'] = getContentGroup(document.referrer.replace(/^.*\/\/[^\/]+/, '')); 35} 36 37//if ($('#jobdetail_id')) { 38// GAGlobalDimension[25] = $('#jobdetail_id').val(); 39//} 40 41window.dataLayer = window.dataLayer || []; 42function gtag(){dataLayer.push(arguments);} 43gtag('js', new Date()); 44if (!(typeof GAGlobalDimension === 'undefined')) { 45 46 var GAGlobalDimensionName = ['url','visitorid','channel','islogin','lang','jobid','joblistmode','abnid','source','abtest','cttm','jobidjobinfo','promotion','sortby','isbannerad','abntype','ctid','aisid','hkettm','resources','timestamp','debug_mode','referrerurl','referrercontentgroup','joblistid','jobdetailid','applyformid','applyid','isnew','eventmodule','rgb']; 47 48 //ga4_dimension_str=''; 49 for (ganum = 1; ganum <= 30; ganum++) { 50 GAGlobalDimension[ganum] == null?{}:gadict[GAGlobalDimensionName[ganum]]=GAGlobalDimension[ganum]; 51 } 52 gadict['timestamp'] = Date.now().toString(); 53 gadict['user_id'] = gadict['ctid']; 54 55} 56gtag('config', 'G-MXTQL33ENQ', gadict); 57// gtag('event', 'login'); 58// End - GA4 59 60// Start - Google Ads event 61if ((GAGlobalDimension[5] != null) && (GAGlobalDimension[11] != null)) { 62 this_event = "" 63 if ((window.location.pathname.indexOf("/job/") == 0) || (window.location.pathname.indexOf("/ctjob/detail/default.asp") == 0)) 64 this_event = 'view_item'; 65 else if (window.location.pathname.indexOf("/ctjob/apply/jobApply.asp") == 0) 66 this_event = 'add_to_cart'; 67 else if (window.location.pathname.indexOf("/ctjob/apply/") == 0) 68 this_event = 'purchase'; 69 else if (GAGlobalDimension[0] != null) 70 if (GAGlobalDimension[0].replace(document.location.origin,'').indexOf("/job/") == 0) 71 this_event = 'view_item'; 72 73 if (this_event.length > 0) 74 gtag('event', this_event, {'send_to': 'AW-995402318','value': 0,'items': [{'id': GAGlobalDimension[5],'location_id': '','google_business_vertical': 'jobs'}]}); 75} 76// End - Google Ads event 77 78 79if (typeof GAGlobalDimension === 'undefined') { 80 // no result 81} 82else { 83 84 85 ga_result_item = "" 86 ga_each_re = "" 87 if ((GAGlobalDimension[5] != null) && (GAGlobalDimension[11] != null)) 88 { 89 90 ga_each_re = GAGlobalDimension[11].split(",") 91 92 for (counti = 0; counti < ga_each_re.length; counti++) { 93 ga_result_item += "{'id':'"+GAGlobalDimension[5]+"','location_id':'"+ga_each_re[counti]+"','google_business_vertical':'jobs'}," 94 } 95 if (ga_result_item != "") { 96 eval("gtag('event', 'page_view', {'send_to': 'AW-995402318','user_id': '" + GAGlobalDimension[16] + "','value': 0,'items': ["+ga_result_item.substr(0,ga_result_item.length-1)+"]});"); 97 98 } 99 100 } 101 else if ((GAGlobalDimension[7] != null) && (GAGlobalDimension[15] != null)) 102 { 103 ga_each_re = GAGlobalDimension[15].split(",") 104 105 for (counti = 0; counti < ga_each_re.length; counti++) { 106 ga_result_item += "{'id':'"+GAGlobalDimension[7]+"','location_id':'"+ga_each_re[counti]+"','google_business_vertical':'custom'}," 107 } 108 if (ga_result_item != "") { 109 eval("gtag('event', 'page_view', {'send_to': 'AW-995402318','user_id': '" + GAGlobalDimension[16] + "','value': 0,'items': ["+ga_result_item.substr(0,ga_result_item.length-1)+"]});"); 110 111 } 112 113 } 114 115} 116 117 118if (document.cookie.match(/^(.*;
118)?\s*successlogin\s*=\s*[^;]+(.*)?$/)) { 119 gtag('event', 'login', { 'send_to': 'G-MXTQL33ENQ' }); 120 document.cookie = "successlogin=;path=/;domain=.ctgoodjobs.hk;expires=Thu, 01 Jan 1970 00:00:01 GMT;" 121} 122 123 124function getContentGroup(my_path) { 125 if ((new RegExp("^/account.*$", "i")).test(my_path)) 126 return 'My Account'; 127 else if ((new RegExp("^/salarycheck.*$|^/careermove.*$", "i")).test(my_path)) 128 return 'Salary Check'; 129 else if ((new RegExp("^/promotions/.*$|^/events/.*$|^/EventCourses/.*$|^/english/aboutus/events_index.asp.*$", "i")).test(my_path)) 130 return 'Event Promotion'; 131 else if ((new RegExp("^/member/login/.*$|^/member/registration/.*$", "i")).test(my_path) ) 132 return 'Login Register'; 133 else if ((new RegExp("^/default.aspx.*$|^/zh.*$|^/default.asp.*$|^/english/graduate/default.asp.*$|^/hotel-catering/default.asp.*$|^/ngo/default.asp.*$|^/part-time/default.asp.*$|^/it-digital/default.asp.*$|^/sales-and-marketing/default.asp.*$", "i")).test(my_path) || (my_path == "/")) 134 return 'Homepage'; 135 else if ((new RegExp("^/myHR/.*$", "i")).test(my_path)) 136 return 'MyHR'; 137 else if ((new RegExp("^/zh/jobs/.*$|^/jobs/.*$|^/industry-jobs/.*$|^/company-jobs/.*$|^/english/search/joblist.*$|^/english/search/summary.*$|^/ctjob/listing/.*$|^/ctjob/enewsletter/.*$|^/ctjob/job_boost/.*$|^/browse-jobs-titles/.*$|^/search-jobs/.*$|^/ctjob/apply-reminder/.*$|^/ctjob/apply-recommend/.*$|^/part-time-jobs.*$|^/human-resources-jobs.*$", "i")).test(my_path)) 138 return 'Job Listing'; 139 else if ((new RegExp("^/ctjob/apply/.*$|^/english/seekers/.*$", "i")).test(my_path)) 140 return 'Apply Now'; 141 else if ((new RegExp("^/zh/job/.*$|^/job/.*$|^/ctjob/detail/.*$", "i")).test(my_path)) 142 return 'Job Details'; 143 else if ((new RegExp("^/english/article/show_article.*$|^/article/.*$|^/news/.*$|^/content-features/.*$|^/resources/.*$|^/tag/.*$|^/tips/.*$|^/columnist/.*$|^/hr-columnist/.*$|^/fi-columnist/.*$|^/blog/.*$|^/talent.*$|^/hrnews.*$|^/keywordsearch.*$|^/learning.*$|^/hrtoolsresources.*$|^/hrinsight.*$|^/mtgt/.*$|^/company/company_profile/.*$|^/besthrpractices/.*$|^/it-digital/article-listing.*$|^/it-digital/resources-listing.*$|^/career-guide/.*$", "i")).test(my_path)) 144 return 'Resources (CT news, articles, blogs)'; 145 else 146 return 'Others'; 147}
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.