使用此插件

getTimeToComplete 函数使用以下参数:

  • sos(可选,字符串):要启动计时器时设置为 "start"。 要停止计时器时设置为 "stop"。 默认为 "start"。
  • cn(可选,字符串):用于存储开始时间的 Cookie 的名称。 默认为 "s_gttc"。
  • exp(可选,整数):Cookie(和计时器)过期的秒数、小时数或天数(具体取决于 tp 分时参数)。 默认为 30 分钟。
  • tp(可选,字符串):Cookie(和计时器)过期的分时字符串,与 exp 参数一起使用。 设置为“d”表示天数,设置为“h”表示小时数,设置为“s”表示秒数。 如果未设置,Cookie(和计时器)过期时间默认为 30 分钟,无论将 exp 参数设置为何值。

调用此函数将返回一个字符串,其中包含从 "start" 到 "stop" 操作所用的时间(天数、小时数、分钟数和/或秒数)。

示例

// Start the timer when the visitor starts the checkout
if(s.events.indexOf("scCheckout") > -1) getTimeToComplete("start");

// Stop the timer when the visitor makes the purchase and set prop1 to the time difference between stop and start
// Sets prop1 to the amount of time it took to complete the purchase process
if(s.events.indexOf("purchase") > -1) s.prop1 = getTimeToComplete("stop");

// Simultaneously track the time it takes to complete a purchase and to fill out a registration form
// Stores each timer in their own respective cookies so they run independently
if(inList(s.events, "scCheckout")) getTimeToComplete("start", "gttcpurchase");
if(inList(s.events, "purchase")) s.prop1 = getTimeToComplete("start", "gttcpurchase");
if(inList(s.events, "event1")) getTimeToComplete("start", "gttcregister", 7, "d");
if(inList(s.events, "event2")) s.prop2 = getTimeToComplete("stop", "gttcregister", 7, "d");

版本历史记录

4.0(2021 年 3 月 19 日)

  • 以上下文数据形式添加了版本号。

3.1(2019 年 9 月 30 日)

  • 添加了要求第一个参数中的值只能为“start”或“stop”的逻辑。 传入的所有其他值都会阻止插件运行。
  • 已将 inList 2.0 插件更新为 inList 2.1。

3.0(2018 年 8 月 23 日)

  • 已将 formatTime v1.0 插件更新为 formatTime v1.1。

3.0(2018 年 4 月 17 日)

  • 小版本发布(重新编译,代码更小)。
  • 若干小错误修复。

2.0(2016 年 6 月 21 日)

  • 消除了对 p_fo 插件的依赖性。
  • 增加了与 H 码和 AppMeasurement 的兼容性。
  • 添加了控制台日志记录。
已自动翻译
使用语言选择器查看此页面的英文版本。
翻译有帮助吗?

Ask AI

Not sure where to start?
Ask me anything about Adobe products.

Type your question or pick a suggestion below.

Use of this AI chatbot is subject to Adobe's Privacy Policy. Don't share sensitive data. AI responses are not your Content, may be inaccurate, and any offers provided are non-binding. Generative AI Terms.