0

WooCommerce 주문에서 'value'및 'order_quantity'를 동적으로 추적하려면 Pinterest 전환 태그를 설치해야합니다. Pinterest 태그는 Javascript의 두 부분으로 구성됩니다. 1 부는 사이트 헤더에 들어있는 기본 코드입니다. 2 부는 Checkout의 헤더에있는 이벤트 코드입니다. WooCommerce 주문에 대한 Pinterest 전환 추적 태그

나는 2 부 (가치와 order_quantity이 WooCommerce 주문에서 끌어 변경해야) 이하로 수정해야 무엇을 생각 :

<script> 
pintrk('track', ' checkout ', { 
    value: {{Enhanced Transaction Revenue}}, 
    order_quantity: {{item.quantity}} 
    }); 
</script> 
<noscript> 
<img height="1" width="1" style="display:none;" alt="" src=" https://ct.pinterest.com/v3/?tid= 123456789 &event= checkout &noscript=1" /> </noscript> 
여기

대표자 변환 태그 가이드 : 난 https://help.pinterest.com/sites/help/files/pinterest_tag_instructions.pdf

이 시점에서 필사적으로 어떤 도움을 주시면 감사하겠습니다.

답변

0

이것을 functions.php에 입력하고 Your_Tag_ID를 Pinterest의 태그 ID와 일치하도록 변경하십시오.

https://docs.woocommerce.com/document/custom-tracking-code-for-the-thanks-page/

https://developers.pinterest.com/docs/ad-tools/conversion-tag/

:

add_action('woocommerce_thankyou', 'pinterest_tracking'); 

function pinterest_tracking($order_id) { 

// Lets grab the order 
$order = wc_get_order($order_id); 

/** 
* Put your tracking code here 
* You can get the order total etc e.g. $order->get_total(); 
*/ 

// This is the order total 
$order_total = $order->get_total(); 
$order_quantity = $order->get_item_count(); 

?> 

<script> 
    pintrk('track', 'checkout', { 
     { 
      value: '<?php echo $order_total ?>', 
      order_quantity: '<?php echo $order_quantity ?>', 
      currency: 'USD' 
     } 
    ]); 
</script> 
<noscript> 
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=Your_Tag_ID&event=checkout&ed[value]=<?php echo $order_total ?>&ed[order_quantity]=<?php echo $order_quantity ?>&noscript=1"/> 
</noscript> 
<?php 

} 

여기에 저를 도와 두 링크입니다