PageSourceSearch

https://www.unicef.or.jp/js/meta.js

js unicef.or.jp collected 2026-09-24 09:30:10 UTC 4,492 bytes, 162 lines download raw bytes

1function getCookieValue(name) {
2    const cookies = document.cookie.split(';');
3    for (let cookie of cookies) {
4        const [key, value] = cookie.trim().split('=');
5        if (key === name) {
6            return decodeURIComponent(value);
7        }
8    }
9    return null; // Cookie‚ª‘¶Ý‚µ‚È‚¢ê‡
10}
11
12const url = location.href;
13const dir_array = location.pathname.split("/");
14const last_dir_array = dir_array.slice(-1)[0];
15const ref = document.referrer;
16const i = (dir_array[1] == "sp" ? 1 : 0);   //dir_array‚̃Cƒ“ƒfƒbƒNƒXBPC/SP‚ŃfƒBƒŒƒNƒgƒŠŠK‘w‚ð‚»‚ë‚¦‚邽‚߁B
17
18//ƒ†[ƒU[ƒƒOƒCƒ“—L–³
19const isLoginValue = getCookieValue('is_login');
20const userLoginStatus = isLoginValue === '1';
21
22//Page Category
23var page_category = dir_array[1];
24
25//Page SubCategory
26var page_subcategory = undefined;
27if (dir_array.length > 2) {
28    page_subcategory = dir_array[2];
29} else {
30    if (last_dir_array.lastIndexOf(".") != -1) {
31        page_subcategory = last_dir_array.substring(0, last_dir_array.lastIndexOf("."));
32    }
33}
34
35//pageType
36var pageType = dir_array[i + 1];
37if (!dir_array[i + 1] || dir_array[i + 1] == "index.html") {     //TOPƒy[ƒW
38    pageType = "Homepage";
39}
40if (dir_array[i + 1] == "msp"
41    || (dir_array[i + 1] == "cooperate" && dir_array[i + 2].indexOf('coop_monthly') !== -1)
42) {
43    pageType = "pledge_lp";
44} else if (dir_array[i + 1] == "cooperate"
45    && (dir_array[i + 2] == "navi"
46        || dir_array[i + 2].indexOf('coop_inh') !== -1
47    )
48    || dir_array[i + 1] == "isan"
49) {
50    pageType = "legacy";
51} else if (dir_array[i + 1] == "cooperate") {
52    pageType = "howtosupport";
53}
54
55if (dir_array[i + 1] == "kinkyu") {
56    pageType = "emergency";
57}
58
59if (dir_array[i + 1] == "special") {
60    pageType = "dm_campaign_lp";
61}
62
63if (dir_array[i + 1] == "news") {
64    pageType = "news";
65}
66
67if (dir_array[i + 1] == "bokin") {
68    pageType = "donate_page";
69}
70
71if (dir_array[i + 1] == "kouji") {
72    pageType = "pagenotfound";
73}
74
75
76//Breakpoint
77var breakpoint = "";
78if ((navigator.userAgent.indexOf('iPhone') > 0 &&
79    navigator.userAgent.indexOf('iPad') == -1) ||
80    navigator.userAgent.indexOf('iPod') > 0 ||
81    navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') > 0) {  //ƒXƒ}ƒz
82
83    breakpoint = "S";
84
85} else {           //PC,ƒ^ƒuƒŒƒbƒg
86    breakpoint = "L";
87}
88
89//title
90var title = document.title;
91
92//donationPurpose
93var donationPurpose = undefined;
94if (!dir_array[i + 1] || dir_array[i + 1] == "index.html"   //TOPƒy[ƒW
95    || dir_array[i + 1] == "cooperate"
96    || dir_array[i + 1] == "msp"
97    || dir_array[i + 1] == "bokin"
98    || dir_array[i + 1] == "isan"
99) {
100    donationPurpose = "Children & Emergencies";
101}
102
103if (dir_array[i + 1] == "kinkyu") {
104    if (!dir_array[i + 2] || dir_array[i + 2] == "index.html") {  //‹Ù‹}TOPƒy[ƒW
105        donationPurpose = "emargency";
106    } else if (dir_array[i + 2]) {
107        donationPurpose = dir_array[i + 2] + "_" + "emargency";
108    }
109}
110
111if (dir_array[i + 1] == "special") {
112    donationPurpose = "generic";
113}
114
115
116//funds_destination
117var funds_destination = undefined;
118if (dir_array[i + 1] == "cooperate"
119    && (dir_array[i + 2] == "navi"
120        || dir_array[i + 2].indexOf('coop_inh') !== -1
121        || dir_array[i + 2].indexOf('coop_monthly') !== -1
122    )
123    || dir_array[i + 1] == "msp"
124    || dir_array[i + 1] == "special"
125    || dir_array[i + 1] == "isan"
126) {
127    funds_destination = "Regular Resources (RR)";
128} else if (dir_array[i + 1] == "cooperate"
129    || dir_array[i + 1] == "bokin"
130) {
131    funds_destination = "RR and OR";
132}
133
134if (dir_array[i + 1] == "kinkyu") {
135    funds_destination = "Other Resources (OR)";
136}
137
138
139//dataLayer
140window.dataLayer = window.dataLayer || [];
141window.dataLayer.push({
142    event: 'Page Meta',
143    userLoginStatus: userLoginStatus,
144    userId: undefined,
145    newsletterSubscriber: undefined,
146    fullPageReferrer: ref,
147    pageCategory: page_category,
148    pageSubcategory: page_subcategory,
149    originalPageUrl: url,
150    articleTitle: title,
151    articleCategory: (typeof category == 'undefined') ? undefined : category,
152    articlePublishDate: (typeof date == 'undefined') ? undefined : date,
153    pageType: pageType,
154    breakpoint: breakpoint,
155    language: 'ja',
156    ABTesting: undefined,
157    abTestGroup: undefined,
158    donationPurpose: donationPurpose,
159    funds_destination: funds_destination
160});
161
162

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.