콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
625 화면

i connect one product with facebook platform 

facebook show below error

아바타
취소
베스트 답변

1. Asegurate de tener tu pixel insertado. Sin integraciones, solo pixel.
2. Asegurate que el pixel sea la unica fuente de datos del catálogo.
3. Añade este código en el código en el head:


<t t-set="retailer_id" t-value="str(product.id)"/>

<t t-set="amount"       t-value="'%.2f' % (product.price or product.website_price or product.list_price)"/>

<t t-set="currency"     t-value="(pricelist and pricelist.currency_id and pricelist.currency_id.name) or 'MXN'"/>

<t t-set="availability" t-value="'in stock' if (product.sudo().qty_available or 0.0) > 0 else 'out of stock'"/>

<t t-set="img_url"      t-value="request.httprequest.url_root + 'web/image/product.template/%s/image_1024' % product.id"/>


4. Añade este código en la pagina de producto "website_sale.product" justo después de la linea que dice "<section id="product_detail"...:
<!-- Microdato de ID para Meta / Google -->

<span itemprop="productID" style="display:none"> <t t-esc="product.default_code or product.id"/>

</span>

<meta property="product:retailer_item_id" t-att-content="product.default_code or product.id"/>

<t t-set="retailer_id" t-value="str(product.id)"/>  <!-- o SKU: product.default_code or str(product.id) -->

<t t-set="availability" t-value="'in stock' if (product.sudo().qty_available or 0.0) &gt; 0 else 'out of stock'"/>

<t t-set="amount" t-value="float(product.list_price or 0.0)"/>

<t t-set="currency" t-value="(pricelist and pricelist.currency_id and pricelist.currency_id.name) or 'MXN'"/>

<t t-set="desc_txt" t-value="product.description_sale or product.name"/>


<div id="fbProductMeta" t-att-data-id="retailer_id" t-att-data-availability="availability" t-att-data-amount="'%.2f' % amount" t-att-data-currency="currency" t-att-data-name="product.name" t-att-data-desc="desc_txt" style="display:none"/>


<script>

document.addEventListener('DOMContentLoaded', function () {

try {

if (typeof window.fbq !== 'function') return;

var d = document.getElementById('fbProductMeta').dataset;

function cleanId(s){ return String(s||'').replace(/[\[\]"']/g,'').trim(); }

var cid = cleanId(d.id);

 var amt = parseFloat(d.amount||'0')||0;

 var cur = (d.currency||'MXN').toUpperCase();

var nm  = (d.name||'').replace(/["']/g,' ');

var ds  = (d.desc||'').replace(/["']/g,' ');

  var p   = {};

p.content_ids  = [cid];

p.content_type = 'product';

p.content_name = nm;

p.value        = amt;

p.currency     = cur;

p.availability = d.availability||'';

p.description  = ds;

p.price        = amt.toFixed(2)+' '+cur;

p.url          = location.href;

var img = document.querySelector('#product_details img[src*="/web/image/"]');

if (img) p.image_url = img.src;

fbq('track', 'ViewContent', p);

} catch(e) { if (console) console.warn(e); }

 ​});

</script>


Quiza haya mejoras que se puedan hacer en este código pero a mi me funcionó.








아바타
취소
관련 게시물 답글 화면 활동
1
2월 25
584
2
8월 25
1870
2
7월 25
3513
1
7월 25
732
0
5월 25
1200