|
@@ -1,3 +1,4 @@
|
|
|
+import { Local } from "@/utils/storage";
|
|
|
import { useEffect, useState } from "react";
|
|
|
|
|
|
/**
|
|
@@ -16,13 +17,13 @@ type PixelType = "kwai_pixel" | "facebook_pixel";
|
|
|
const useEventPoint = () => {
|
|
|
const [source, setSource] = useState<PixelType | null>(null);
|
|
|
useEffect(() => {
|
|
|
- setSource(localStorage.getItem("pixel_type") as PixelType | null);
|
|
|
+ setSource(Local.getKey("ban_pixel_type"));
|
|
|
}, []);
|
|
|
|
|
|
// 查看内容 | null
|
|
|
const eventView = () => {
|
|
|
if (source === "kwai_pixel") {
|
|
|
- window.kwaiq.instance(localStorage.getItem("pixel_id")!).track("contentView");
|
|
|
+ window.kwaiq.track("contentView");
|
|
|
}
|
|
|
if (source === "facebook_pixel") {
|
|
|
window.fbq("track", "ViewContent");
|
|
@@ -31,7 +32,7 @@ const useEventPoint = () => {
|
|
|
// 注册
|
|
|
const eventRegister = () => {
|
|
|
if (source === "kwai_pixel") {
|
|
|
- window.kwaiq.instance(localStorage.getItem("pixel_id")!).track("completeRegistration");
|
|
|
+ window.kwaiq.instance(Local.getKey("ban_pixel_id")).track("completeRegistration");
|
|
|
}
|
|
|
if (source === "facebook_pixel") {
|
|
|
window.fbq("track", "CompleteRegistration");
|
|
@@ -52,10 +53,10 @@ const useEventPoint = () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- // 加入购物车
|
|
|
+ // 充值
|
|
|
const eventPurchase = () => {
|
|
|
if (source === "kwai_pixel") {
|
|
|
- window.kwaiq.instance(localStorage.getItem("pixel_id")!).track("purchase");
|
|
|
+ window.kwaiq.instance(Local.getKey("ban_pixel_id")).track("purchase");
|
|
|
}
|
|
|
if (source === "facebook_pixel") {
|
|
|
window.fbq("track", "AddToCart");
|
|
@@ -72,7 +73,7 @@ const useEventPoint = () => {
|
|
|
//首充事件
|
|
|
const eventFirstDeposit = () => {
|
|
|
if (source === "kwai_pixel") {
|
|
|
- window.kwaiq.instance(localStorage.getItem("pixel_id")!).track("firstDeposit");
|
|
|
+ window.kwaiq.instance(Local.getKey("ban_pixel_id")).track("firstDeposit");
|
|
|
}
|
|
|
if (source === "facebook_pixel") {
|
|
|
window.fbq("track", "Purchase");
|