Same Event ID Received for Many Event Instances Facebook + WooCommerce

1.4k Views Asked by At

I use Facebook Pixel for WooCommerce site and in Event Manager of Facebook Business profile I see message about this issue:

You're sending the same event ID for many instances of your AddToCart events. Event IDs are unique identifiers that are used to deduplicate identical events received from your pixel and the Conversions API so they're not counted twice. To ensure Facebook is accurately counting your events, each unique event instance needs its own unique event ID. This may cause issues with the measurement of your events and the attribution of your ad campaigns.

As far as I understand, eventID must be updated by JavaScript every time someone presses "Add to cart" button?

If it is right, where/when I should update this eventID?

If it is no, could you please tell what should I do to fix this issue?

(I am beginner in Facebook integrations and WooCommerce, so I am sorry if this question is too obvious)

1

There are 1 best solutions below

0
On

I'm sending ADDTOCART event via FB pixel JS as below. I'm adding a unique number in eventID so that each time this is called it should have different ID with it.

var random_num = 1 + Math.floor(Math.random() * 100);
fbq('track', 'AddToCart', {
    content_ids: ['1122', '3234'],
    content_type: 'product'
}, {eventID: "AddToCart_" + social_media_eventId + "_" + random_num});