使用 Shopify 版 Pinterest 應用程式,將您的 Shopify 商店連結到您的 Pinterest 企業帳號。
Shopify 商店一次只能與一個 Pinterest 企業帳號連結。如果您有兩家 Shopify 商店,請
如果您已手動將 Pinterest 標籤新增至 Shopify,或已使用其他第三方新增這項標籤,就必須
將您的 Shopify 商店連結到您的 Pinterest 帳號前,您需要:
理想情況下,您應使用桌面上的 Chrome 瀏覽器,將 Shopify 商店連線至您的 Pinterest 帳號。
雖然可以手動將 Pinterest 標籤新增至 Shopify,但我們不建議使用。在可能的情況下,請按照上述步驟將您的商店與 Shopify 版 Pinterest 應用程式連結,以便自動新增標籤。
新增基本代碼
基本代碼可讓您取得有關事件的資料,例如有人購買產品或將產品加入購物籃。您網站上的所有頁面均須安裝基本代碼。
- 在您的 Shopify 管理員中,按一下「線上商店」,然後按一下「佈景主題」。
- 瀏覽至想要編輯的佈景主題,按一下「動作」,然後按一下「編輯程式碼」
- 按一下「theme.liquid」。
- 捲動畫面直到看到 </head>,然後將以下程式碼貼至其上方:
<script type="text/javascript"> !function(e){if(!window.pintrk){window.pintrk=function() {window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var n=window.pintrk;n.queue=[],n.version="3.0";var t=document.createElement("script");t.async=!0,t.src=e;var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r)}} ("https://s.pinimg.com/ct/core.js"); pintrk('load','YOUR_TAG_ID', { em: '{{ customer.email }}', }); pintrk('page'); </script> <noscript> <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&noscript=1"/> </noscript>
- 使用您的專屬標籤 ID 取代 YOUR_TAG_ID。要查找專屬標籤 ID,請前往 Pinterest 上的「廣告管理員」。
- 導覽至您的轉換率追蹤概覽,然後找到詳細資料區段。
- 複製「標籤 ID」下的 13 碼數字,然後將該數字貼到程式碼,取代其中的 YOUR_TAG_ID。
新增 Checkout 事件
安裝基本代碼後,您可以新增其他事件以收集其他資料。您可以新增 Checkout 事件,追蹤使用者購買產品和完成交易的時機。
- 在您的 Shopify 管理員中,按一下「設定」,然後按一下「結帳」。
- 將以下追蹤程式碼貼到「訂單狀態頁面指令碼」下的文字方塊。如果此方格內已有代碼,請將您的追蹤代碼貼在其後:
{% if first_time_accessed %} <script type="text/javascript"> !function(e){if(!window.pintrk){window.pintrk=function() {window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var n=window.pintrk;n.queue=[],n.version="3.0";var t=document.createElement("script");t.async=!0,t.src=e;var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r)}} ("https://s.pinimg.com/ct/core.js"); pintrk('load','YOUR_TAG_ID', { em: '{{ customer.email }}', }); pintrk('page'); </script> <noscript> <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&noscript=1"/> </noscript> <script> pintrk('track', 'checkout',{ value: {{ total_price }} / 100, currency: '{{ currency }}', order_quantity: 2, event_id: '{{ event_id }}', line_items: [ { product_name: '{{ product_name_1 }}', product_id: '{{ product_id_1 }}', product_price: {{ product_price_1 }}, product_quantity: 1 }, { product_name: '{{ product_name_2 }}', product_id: '{{ product_id_2 }}', product_price: {{ product_price_2 }}, product_quantity: 1 }, ], order_id: {{ checkout.order_id}} }); </script> <noscript> <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=checkout&noscript=1"/> </noscript> {% endif %}
- 使用您的專屬標籤 ID 取代 YOUR_TAG_ID。要查找專屬標籤 ID,請前往 Pinterest 上的「廣告管理員」。
新增 AddToCart 事件 (選擇性)
安裝基本代碼後,您可以選擇性新增其他事件以收集其他資料。您可以新增 AddToCart 事件,追蹤使用者將產品加入購物車的時機。
注意:使用部分 Shopify 佈景主題和小工具會無法新增 AddToCart 事件。
- 在您的 Shopify 管理員中,按一下「線上商店」,然後按一下「佈景主題」。
- 在目前使用的主題中,按一下「動作」和「編輯代碼」。
- 在「範本」下方,找出名稱為 product.liquid-template.liquid,或 product-form.liquid 的程式碼檔案,並開啟該檔案。這個步驟會依您安裝的佈景主題而有所不同,但加入購物車按鈕的程式碼最常見於 products.liquid 或類似的檔案。
- 在該程式碼檔案中搜尋 addtocart。
- 將以下程式碼置於
<button> 或 <input> 元素的結尾插入點中:onclick="pintrk('track', 'addtocart');"
- 按一下右上角的「儲存」。
如果您已經手動安裝 Pinterest 標籤,現在想改用 Shopify 版 Pinterest 應用程式,則應先移除手動安裝的標籤。務必移除基本代碼、Checkout 程式碼和 AddToCart 程式碼。
移除基本代碼
- 在您的 Shopify 管理區中,按一下 「網路商店」,然後按一下「主題」
- 瀏覽至想要編輯的佈景主題,按一下「動作」,然後按一下「編輯程式碼」
- 按一下「theme.liquid」
- 捲動畫面直到看到 </head>,然後找到以下程式碼:
<script type="text/javascript"> !function(e){if(!window.pintrk){window.pintrk=function() {window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var n=window.pintrk;n.queue=[],n.version="3.0";var t=document.createElement("script");t.async=!0,t.src=e;var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r)}} ("https://s.pinimg.com/ct/core.js"); pintrk('load','YOUR_TAG_ID', { em: '{{ customer.email }}', }); pintrk('page'); </script> <noscript> <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&noscript=1"/> </noscript>
移除 Checkout 程式碼
- 在您的 Shopify 管理員中,按一下「設定」,然後按一下「結帳」。
- 在「訂單狀態頁面指令碼」部分,找出位於文字方塊的下列追蹤程式碼。如果此方塊中有其他程式碼,務必僅移除以下這段程式碼:
{% if first_time_accessed %} <script type="text/javascript"> !function(e){if(!window.pintrk){window.pintrk=function() {window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var n=window.pintrk;n.queue=[],n.version="3.0";var t=document.createElement("script");t.async=!0,t.src=e;var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r)}} ("https://s.pinimg.com/ct/core.js"); pintrk('load','YOUR_TAG_ID', { em: '{{ customer.email }}', }); pintrk('page'); </script> <noscript> <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&noscript=1"/> </noscript> <script> pintrk('track', 'checkout',{ value: {{ total_price | money_without_currency }}, currency: '{{ currency }}', order_quantity: 1, order_id: {{ checkout.id }} }); </script> <noscript> <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=checkout&noscript=1"/> </noscript> {% endif %}
移除 AddToCart 程式碼
- 在您的 Shopify 管理員中,按一下「線上商店」,然後按一下「佈景主題」。
- 在目前使用的佈景主題中,依序按一下「動作」和「編輯程式碼」。
- 在「範本」下,找到名為 product.liquid、product-template.liquid 或 product-form.liquid 的程式碼檔案,並開啟該檔案。這會依您安裝的佈景主題而有不同,但加入購物車按鈕的程式碼最常見於 products.liquid 或類似的檔案。
- 在該檔案中搜尋 addtocart。
- 找到並移除以下程式碼。應在 <button<button> 的結尾插入點>或<input> 元素:
onclick="pintrk('track', 'addtocart');"
- 按一下右上角的「儲存」。