1

We are using PWA Venia Reactjs setup and We integrated Meta pixel event called ViewContent in our site using below code :

src/components/ProductFullDetail/ProductFullDetail.Js

<script>
fbq('track', 'ViewContent');
</script>

we want to pass "Product name" as parameter for event "ViewContent" . So we tried below code

fbq('track','ViewContent', {
    'name': product?.name
    });

Here is full code : https://pastebin.com/LLDEt8ig

Issue :

We can not able to fetch the parameter Product name in PDP Page.

We are getting only event ViewContent in PDP Page :

enter image description here

But We need parameters along with event ViewContent :

enter image description here

1 Answer 1

1
+200

Hello @Baby in Magento

In the below file, src/components/ProductFullDetail/ProductFullDetail.Js

Add this code hope this will work for you

const productMeta = () => {
    fbq('track', 'ViewContent', {
        'content_name': product?.name,
        'content_ids': product.id,
        'content_type': 'product',
        'value': product?.price_range?.maximum_price?.final_price.value,
        'currency': product?.price_range?.maximum_price?.final_price.currency
    });
}


useEffect(() => {
    productMeta()
}, []);

Please add this const code with other const codes this will work.

Please accept my answer and give upvote if my solution is working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.