Skip to content

跟踪页面空闲

以下是在您的网站上设置跟踪页面空闲的步骤:

第 1 步:放置空闲跟踪代码片段

第一步是在主 Aimtell 跟踪脚本上方添加以下代码片段:

txt
<!-- place the following code above the main Aimtell Tracking Script -->
<script>
var _aimtellTimeout;

function _aimtellResetTimer() {
  // clear the existing timer
  clearTimeout(_aimtellTimeout);

  // set a new timer for 30 seconds
  _aimtellTimeout = setTimeout(function () {
    // on timeout, track the event with current page
    // add optional variables for personalization of the item they went inactive on
    // (e.g. related items, related pages to send them to)
    _at.track("event", {
      "category": "Page",
      "action": "Inactive",
      "variables": {
        "page": window.location.href
      }
    })
  }, 30000);
}

function _aimtellReady() {
  // start or reset timer on mouse move
  document.onmousemove = _aimtellResetTimer;
}
</script>

请注意,您可以添加可选变量以实现更多个性化,例如相关商品或相关页面。

第 2 步:检查您的日志

将代码添加到站点后,我们建议您检查日志以查看自定义事件是否已开始跟踪。前往“日志”>“自定义事件”查看它是否存在。我们建议让代码运行 24 小时,以便您可以轻松查看仪表板中记录的事件。

第 3 步:创建触发式推送活动

现在是时候创建触发式推送活动了,每当订阅者激活触发器时就会发送该活动,在这种情况下意味着他们在页面上处于非活动状态。从仪表板前往“触发的营销活动”并创建一个新的营销活动。对于您的触发器,事件类别为“页面”,事件操作为“非活动”。

请阅读我们的 创建触发式推送活动 文档,获取有关如何执行此操作的分步指南。

注意:默认情况下,Aimtell 每次会话仅跟踪一次相同的事件。如果用户永远保持不活动状态,这将防止创建大量事件,从而确保用户不会收到大量通知的垃圾邮件。