使用此插件

addProductEvent 函数使用以下参数:

  • en(必需,字符串):要添加到 products 变量中最后一个条目的事件。 如果 products 变量为空,则会创建一个“空白”产品条目,并附加事件(及其值)。
  • ev(必需,字符串):分配给 en 参数中的数值或货币事件的值。 如果未设置,则默认为 1。 未包含在字符串引号中的数字也是有效的。
  • ap(可选,布尔值):如果产品变量当前包含多个产品条目,则值为 true(或 1)会将事件添加到所有产品条目。 如果未设置,则默认为 false。

addProductEvent 不会返回任何结果。 而是将事件及其值添加到 products 变量。 该插件还会自动将事件添加到 events 变量中,因为此变量也需要该事件。

addProductEvent 函数不会创建或使用任何 Cookie。

示例

// Sets the products variable to ";product1;3;300,;product2;2;122,;product3;1;25;event35=25".
// Also sets the events variable to "purchase,event35".
s.products = ";product1;3;300,;product2;2;122,;product3;1;25";
s.events = "purchase";
addProductEvent("event35", "25");

// Sets the products variable to ";product1;3;300;event35=25,;product2;2;122;event35=25,;product3;1;25;event35=25".
s.products = ";product1;3;300,;product2;2;122,;product3;1;25";
addProductEvent("event35", 25, true);

// Sets the products variable to ";product1;3;300;event2=10;eVar33=large|eVar34=men|eVar35=blue,;product2;2;122,;product3;1;25;event33= 12|event34=10|event35=15"
// Also sets the s.events variable to "purchase,event2,event33,event34,event35".
s.products=";product1;3;300;event2=10;eVar33=large|eVar34=men|eVar35=blue,;product2;2;122,;product3;1;25";
s.events="purchase,event2";
addProductEvent("event33", "12");
addProductEvent("event34", "10");
addProductEvent("event35", "15");

// Sets the products variable to ";product1;3;300;event2=10|event33=12|event34=10|event35=15;eVar33=large|eVar34=men|eVar35=blue,;product2;2;122;event33=12|event34=10|event35=15,;product3;1;25;event33=12|event34=10|event35=15".
// Also sets the events variable to "purchase,event2,event33,event34,event35".
s.products=";product1;3;300;event2=10;eVar33=large|eVar34=men|eVar35=blue,;product2;2;122,;product3;1;25"
s.events="purchase,event2"
addProductEvent("event33", "12", 1);
addProductEvent("event34", 10, 1);
addProductEvent("event35", "15", 1);

// If the products variable isn't already set, sets it to ";;;;event35=25".
// Also appends event35 to the events variable.
addProductEvent("event35", "25");

版本历史记录

2.0(2021 年 3 月 19 日)

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

1.0(2019 年 10 月 7 日)

  • 第一版。
已自动翻译
使用语言选择器查看此页面的英文版本。
翻译有帮助吗?

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.