点击左下角 Settings
,进入 Shopify 设置界面
点击 Customer events
点击 Add custom pixel
创建自定义像素
输入代码
// Step 1. Initialize the JavaScript pixel SDK (make sure to exclude HTML)
!function(y,u,r,i){y._yuri_track||((n=y._yuri_track=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)}).queue=n.queue||[],y._yuri_track._fp||(y._yuri_track._fp=1,t=u.createElement(r),s=u.getElementsByTagName(r)[0],t.async=1,t.src=i,s.parentNode.insertBefore(t,s)))}(window,document,"script","https://cdn.jsdelivr.net/gh/adzon/assets/pixel.js?_rid={click_id}");
// Step 2. Subscribe to customer events with analytics.subscribe(), and add tracking
analytics.subscribe("checkout_completed", event => {
_yuri_track("Purchase");
});
analytics.subscribe("product_added_to_cart", event => {
_yuri_track("AddToCart");
});
点击页面上方按钮保存
之后点击 Connect
链接像素即可
完成效果
之后就可以在尤里改收到 Shopify 回传的事件了。