Inhalte aufrufen

Profilbild

How do you set facebook events ?

facebook

Best Answer Marcus Gesing , 23 December 2021 - 18:36

I would recommend doing this in a plugin and using widgets. Similar to what the Google Analytics plugin does. The plugin is quite simple. It checks the route data of the request to determine the checkout completed page and then loads the last order for the current customer. For the product detail page, you should be able to get the product ID from the route data as well, see the "productId" parameter.
 
Go to the full post


  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
1 Antwort zu diesem Thema

#1 mihai8822m

mihai8822m

    Benutzer

  • Members
  • 28 Beiträge

Geschrieben: 22 December 2021 - 14:26

Hello ,

 

How do you guys set the facebook ads events on the pages? Do you use a plugin?

 

I need to set the product ID event, the shopping cart total and ID`s and the order completed page event.

 

The code for this events are:

 

<script>
fbq('track', 'ViewContent', {
content_type: 'product', //either 'product' or 'product_group'
content_ids: ['id_produs'], //array of one or more product ids in the page
value: pret_produs, //OPTIONAL, but highly recommended
currency: 'RON' //REQUIRED if you a pass value
});
</script>
 
<script>
fbq('track', 'AddToCart', {
content_type: 'product',
content_ids: ['id_produs1', ‘id_produs2', ]
});
</script>
 
<script>
fbq('track', 'Purchase', {
value: 'total_comanda', 
currency: 'RON', 
content_type: 'product', 
content_ids: ['id_produs1', 'id_produs2', ] 
});
</script>

 



#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3692 Beiträge

Geschrieben: 23 December 2021 - 18:36   Best Answer

I would recommend doing this in a plugin and using widgets. Similar to what the Google Analytics plugin does. The plugin is quite simple. It checks the route data of the request to determine the checkout completed page and then loads the last order for the current customer. For the product detail page, you should be able to get the product ID from the route data as well, see the "productId" parameter.
 

  • stefanmueller gefällt das

Schöne Grüße aus Düsseldorf,
Marcus Gesing



Auch markiert mit einem oder mehrerer dieser Schlüsselwörter: facebook