浏览代码

調整 utm 參數

SyuanYu 10 月之前
父节点
当前提交
05bea1abb9
共有 1 个文件被更改,包括 29 次插入2 次删除
  1. 29 2
      layouts/partials/footer.html

+ 29 - 2
layouts/partials/footer.html

@@ -31,7 +31,8 @@
         <div class="footer-contacts">
           <h5>CONTACT</h5>
           <div>
-            集仕多股份有限公司<br>新竹縣竹北市復興二路229號9樓之9<br>聯絡電話:<a href="tel:+886036670804">036670804</a><br>聯絡信箱:SERVICE@CHOOZMO.COM
+            集仕多股份有限公司<br>新竹縣竹北市復興二路229號9樓之9<br>聯絡電話:<a
+              href="tel:+886036670804">036670804</a><br>聯絡信箱:SERVICE@CHOOZMO.COM
           </div>
         </div>
       </div>
@@ -40,7 +41,7 @@
 
   <!-- LINE 按鈕 -->
   <div class="line-btn">
-    <a href="https://lin.ee/jYalbZq?utm_source=web&utm_medium=article&utm_campaign=AICUSTOMER" target="_blank">
+    <a href="https://lin.ee/jYalbZq" target="_blank">
       <img src="/imgs/icon/line.png" alt="">
     </a>
   </div>
@@ -69,4 +70,30 @@
     $('.privacy-consent').hide();
     localStorage.setItem('privacy', 'false');
   })
+
+  function setUTM() {
+    // 取當前網址路徑
+    let currentPath = window.location.pathname;
+    console.log('currentPath', currentPath);
+
+    let utmCampaign = ""; // utm 參數
+
+    if (currentPath === "/virtual-host-solution/") {
+      // AI 主持人
+      utmCampaign = "AIGV";
+    } else if (currentPath === "/AI-chatbot/") {
+      // AI 客服
+      utmCampaign = "AICUSTOMER";
+    } else if (currentPath === "/ai-balanced-news-reporting/") {
+      // AI 記者
+      utmCampaign = "AICOPYWRITER";
+    }
+
+    let lineLink = $('a[href="https://lin.ee/jYalbZq"]');
+    let originalHref = lineLink.attr('href');
+    let newHref = originalHref + `?utm_source=web&utm_medium=article&utm_campaign=${utmCampaign}`;
+    lineLink.attr('href', newHref);
+  }
+
+  setUTM();
 </script>