Facebook CAPI Purchase Optimize

Conversion API (CAPI) is designed to create a connection between an advertiser's marketing data from various sources and Meta's system, optimizing ad targeting, reducing cost per result, and measuring outcomes.

Instead of maintaining separate connection points for each data source, you can leverage the Conversion API to send multiple types of events.

This article will guide you on setting up the Conversions API on AhaChat, allowing the chatbot to automatically send events when customers successfully place an order or when staff create an order for a customer directly to Meta. This helps businesses accurately track purchasing behavior, optimize ad campaigns, and increase conversion rates.

Terminology and Definitions

Dataset (Pixel): A data source from Meta to collect conversion signals from external sources. This data is referred to as "Events."

Event: Information describing customer (subscriber) actions. There are the following types of events:

  • Purchase
  • Lead Submitted
  • Qualified Lead
  • Order Created
  • Order Shipped
  • Order Canceled
  • Order Returned
  • View Content
  • AddToCart
  • Initiate Checkout

Conversion: Simply put, it is the transition from entity state A to state B. It represents the ratio of users clicking on an advertisement based on a specific goal. For example, they might visit to look for product information, place an order, make a payment, or register as a member. Depending on the fanpage's specific field, objectives can be set to increase the conversion rate accordingly.

Specific Example:

For a fanpage specializing in children's toys, a recent Click-to-Messenger ad campaign recorded 650 messages, of which 270 were purchase registrations. The conversion rate can be calculated as follows:

CR = 270/650 * 100% = 41%

1. Set up a Dataset on AhaChat.

Check out the full guide in this article

2. Create and send events from the Chatbot to Meta.

Case 1: Send events from the flow.

In a flow on AhaChat, you need blocks to collect information from customers, then connect the Facebook CAPI block at the final step of the flow.

Open the block and select the event listed in the Facebook CAPI block.

If you select the Purchase event, the value can be entered directly or use attribute as shown in the image below.

Click Send to check if the event is successfully sent. You will receive the result in JSON format.

You can create an additional conditional branch to check if the event has run successfully, including error messages, and send notifications to the administrator or another system.

Example:

{{api.block_name.events_received}} is not equal to 1 => Error

To get the error notification content:

{{api.block_name.messages}}

Case 2: Send events from Live Chat menu.

In the LiveChat menu on AhaChat, to send a Purchase event after the agent confirms the order with the customer to Meta for tracking, click on the đ icon → enter the product and value, then click Create to send the event.

Case 3: Automatically Sync CAPI Events

To enable this feature, go to the Settings menu → select the General tab and scroll down to find the Synchronize CAPI events section → enable Purchase.

The Purchase event will be automatically sent to the Dataset when:

  • Creating an order in Livechat

Case 4: Send events from an external CRM source.

To send events from an external source, you need to use AhaMake to send data to the Chatbot.

In this example, we use AhaMake to receive information from Haravan when a new order is created, and then send it to the Chatbot to trigger the CAPI block.

On AhaChat → Create a CAPI flow with the value using the attribute "{{sotien}}".

On AhaMake, create a Flow with the Trigger "New Order" from the Haravan app (see the Haravan user guide here).

Next, create the AhaChat app with the action "Send Broadcast Block." Retrieve the information from the Haravan Trigger to pass it along (see the guide for using actions with AhaChat here).

Note: To send the data to the Chatbot, you need to synchronize the MESSENGER_USER_ID of the customer between AhaChat and the CRM (Haravan).

With just these 2 steps, when you create an order on Haravan, the order information will be sent through the Trigger from AhaMake, then forwarded to the Chatbot to activate the CAPI block and send the event to Meta.

3. Results

If everything is done correctly, you will be able to view the results in the overview report section of the Event Manager.