1(function ($) { 2 3 /** 4 * æå®ãããDOMè¦ç´ ã®ã¯ã©ã¹ã«åºã¥ãã¦cta_indexã®å¤ãè¿ãã¾ãã 5 * 6 * @param {Object} element - 調æ»ããDOMè¦ç´ ã 7 * @return {string} cta_index - è¦ç´ ã®ã¯ã©ã¹ã«åºã¥ãã¦æ±ºå®ãããcta_indexã®å¤ã 8 */ 9 function getCtaIndex(element) { 10 var cta_index; 11 12 if ($(element).hasClass('cta-index-common')) { 13 cta_index = 'common'; 14 } else if ($(element).hasClass('cta-index-potential')) { 15 cta_index = 'potential'; 16 } else if ($(element).hasClass('cta-index-eventually')) { 17 cta_index = 'eventually'; 18 } else if ($(element).hasClass('cta-index-compare')) { 19 cta_index = 'compare'; 20 } else if ($(element).hasClass('cta-index-prospect')) { 21 cta_index = 'prospect'; 22 } else if ($(element).hasClass('cta-index-page_ab_test')) { 23 cta_index = 'pageABtest'; 24 } else if ($(element).hasClass('cta-index-floating1')) { 25 cta_index = 'floating1'; 26 } else if ($(element).hasClass('cta-index-floating2')) { 27 cta_index = 'floating2'; 28 } else if ($(element).hasClass('cta-index-popup')) { 29 cta_index = 'popup'; 30 } 31 return cta_index; 32 } 33 34 // CTA è¡¨ç¤ºåæ° 35 $('[id^="js-cta-inview-"]').on('inview', function (event, isinview) { 36 37 var cta_index = getCtaIndex(this); 38 39 if (isinview) { 40 $.ajax({ 41 type: 'post', 42 url: emanonCTA.admin_url, 43 data: { 44 'action': 'emanon_cta_impression', 45 'security': emanonCTA.ajax_nonce, 46 'cta_index': cta_index 47 }, 48 success: function (response) { 49 // æåæã®å¦ç 50 }, 51 error: function () { 52 // ã¨ã©ã¼æã®å¦ç 53 }, 54 complete: function () { 55 // å®äºæã®å¦ç 56 } 57 }); 58 } else { 59 // ãã¥ã¼ãã¼ãå¤ã«è¡¨ç¤ºãããå ´åã®å¦ç 60 $('[id^="js-cta-inview-"]').off('inview'); 61 } 62 }); 63 64 // CTA ã¯ãªãã¯æ° 65 $('[id^="js-cta-inview-"]').click(function () { 66 67 var cta_index = getCtaIndex(this); 68 69 $.ajax({ 70 type: 'post', 71 url: emanonCTA.admin_url, 72 data: { 73 'action': 'emanon_cta_click', 74 'security': emanonCTA.ajax_nonce, 75 'cta_index': cta_index 76 }, 77 success: function (response) { 78 // æåæã®å¦ç 79 }, 80 error: function () { 81 // ã¨ã©ã¼æã®å¦ç 82 }, 83 complete: function () { 84 // å®äºæã®å¦ç 85 } 86 }); 87 }); 88 89 /** 90 * æå®ãããDOMè¦ç´ ã®ã¯ã©ã¹ã«åºã¥ãã¦cta_cvã®å¤ãè¿ãã¾ãã 91 * 92 * @param {Object} element - 調æ»ããDOMè¦ç´ ã 93 * @return {string} cta_cv - è¦ç´ ã®ã¯ã©ã¹ã«åºã¥ãã¦æ±ºå®ãããcta_cvã®å¤ã 94 */ 95 function getCtaCV(element) { 96 var cta_cv; 97 98 if ($(element).hasClass('cta-cv-common')) { 99 cta_cv = 'common'; 100 } else if ($(element).hasClass('cta-cv-potential')) { 101 cta_cv = 'potential'; 102 } else if ($(element).hasClass('cta-cv-eventually')) { 103 cta_cv = 'eventually'; 104 } else if ($(element).hasClass('cta-cv-compare')) { 105 cta_cv = 'compare'; 106 } else if ($(element).hasClass('cta-cv-prospect')) { 107 cta_cv = 'prospect'; 108 } else if ($(element).hasClass('cta-cv-page_ab_test')) { 109 cta_cv = 'pageABtest'; 110 } else if ($(element).hasClass('cta-cv-floating1')) { 111 cta_cv = 'floating1'; 112 } else if ($(element).hasClass('cta-cv-floating2')) { 113 cta_cv = 'floating2'; 114 } else if ($(element).hasClass('cta-cv-popup')) { 115 cta_cv = 'popup'; 116 } 117 return cta_cv; 118 } 119 120 // CTA ã³ã³ãã¼ã¸ã§ã³ 121 $('#js-cta-cv').on('inview', function (event, isinview) { 122 123 var cta_cv = getCtaCV(this); 124 125 if (isinview) { 126 $.ajax({ 127 type: 'post', 128 url: emanonCTA.admin_url, 129 data: { 130 'action': 'emanon_cta_cv', 131 'security': emanonCTA.ajax_nonce, 132 'cta_index': cta_cv 133 }, 134 success: function (response) { 135 // æåæã®å¦ç 136 }, 137 error: function () { 138 // ã¨ã©ã¼æã®å¦ç 139 }, 140 complete: function () { 141 // å®äºæã®å¦ç 142 } 143 }); 144 // inview ããªãã«ãã 145 $('#js-cta-cv').off('inview'); 146 } 147 }); 148 149 // ãªã»ãã 150 $('.js-cta-reset').click(function (event) { 151 var table = $(this).parents('#js-cta-table'); 152 event.preventDefault(); 153 154 if (window.confirm(emanonCTA.confirm_text)) { 155 var cta_index = $(this).data('cta-index'); 156 var cta_row = $(this).data('cta-row'); 157 158 $.ajax({ 159 type: 'post', 160 url: emanonCTA.admin_url, 161 data: { 162 'action': 'emanon_cta_reset', 163 'security': emanonCTA.ajax_nonce, 164 'cta_index': cta_index 165 }, 166 success: function (response) { 167 var ctaTableRow = table.find('.cta-table__row').eq(cta_row); 168 var metrics = ['impression', 'click', 'ctr', 'cv', 'cvr']; 169 170 // ã«ã¼ãã使ç¨ãã¦ãåã¡ããªã¯ã¹ã®å¤ããªã»ãã 171 $.each(metrics, function (index, metric) { 172 var value = metric === 'ctr' || metric === 'cvr' ? '0.0%' : '0'; 173 ctaTableRow.find('.cta-table__' + metric).text(value); 174 }); 175 }, 176 error: function () { 177 alert('ãã¼ã¿ã®åæåã«å¤±æãã¾ãããå度ã試ããã ããã'); 178 } 179 }); 180 } 181 }); 182 183})(window.jQuery);
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.