-1, isSourceGoogleAD = getUrlParameter('utm_source').indexOf('google_ad_') > -1, isSourceRP = getUrlParameter('utm_source').indexOf('RP_') > -1; if ((isSourceFB || isSourceFBAD || isSourceGoogleAD || isSourceRP) && articleInner) { var tkExtraParameters = { 'facebook_ad_01': 'facebook_ad_01', 'facebook_ad_02': 'retargeting_01', 'facebook_ad_03': 'retargeting_02', 'google_ad_01': 'google_ad_01', 'google_ad_02': 'potential_01', 'google_ad_03': 'potential_02' }, testLinks = { 'https://pse.is/JYM9N': '201900120', 'https://pse.is/KUPSW': '201900031', 'https://pse.is/JZH8A': '201900033', 'https://pse.is/KA6L2': '201900024', 'https://pse.is/JVKPG': '201900059', 'https://pse.is/KQZAY': '201900060', 'https://pse.is/FVBTP': '201900049', 'https://pse.is/G6C2N': '201900061', 'https://pse.is/MRBTY': '201900187', 'https://pse.is/MKGUR': '201900189' }; [].forEach.call(articleInner.querySelectorAll('a'), function (link) { if (Object.keys(testLinks).indexOf(link.href) > -1) { var utmSource = getUrlParameter('utm_source'); link.href = 'https://richart.tw/TSDIB_RichartWeb/RC07/RC070400?sn=' + testLinks[link.href] + '&tk=' + ((Object.keys(tkExtraParameters).indexOf(utmSource) > -1) ? tkExtraParameters[utmSource] : utmSource); } }); } function getUrlParameter (name) { var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(window.location.search); return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); }; })(jQuery);