Facebook Pixel
Last updated
Last updated
To transfer events from the bot’s workflow, you need to have a business account. You can register here
Choose API Conversions
Attention! If the following window opens up during the conversion API configuration, it’s better to leave the settings and start again.
Choose the Pixel you need
Generate an access token and save it in a safe space.
To transfer events to Facebook, you have to have your own domain set up in the mini-landing, it has to be approved on Facebook and “Saving values from cookies to client variables” has to be turned on for Facebook in the mini-landing’s settings:
Now, there will be an automatically filled out variable _fbp in the card of the client that came from the mini-landing. This variable can be transferred to Pixel with the event
You need to configure the following settings in the block, through which you need to transfer the event:
URL of the function: https://store.salebot.ai/function/fb_pixel
An example of the parameters: { "pixel_id": "#{pixel_id}", "access_token": "#{access_token}", "event_name": "Entered the bot", "event_source_url": "https://my_best_site.com", "action_source": "chat", "fbp": "#{_fbp}", "fbc": "#{_fbc}" }
pixel_id - id of the pixel access_token - the token for accessing API event_name - the name of the event. You can use standard names (like Lead, PageView, Purchase and so on; see more here), as well as your own (like Entered the bot) event_source_url - the approved on Facebook domain fbp - the client’s browser id
action_course - (other by default) this field lets you specify where exactly the conversions happened. The information on where the events happened helps to make sure that your advertisements are shown to the right audience. You can set the following values in the field action_source:
email
Conversion took place through email
website
Conversion took place on a site
phone_call
Conversion took place through the phone
chat
Conversion took place through a messenger, SMS or an online-chat
physical_store
Conversion took place in the physical store
system_generated
Conversion happened automatically, i.e. as a result of a monthly subscription renewal
other
Conversion happened another way
To test, you need to add the parameter test_event_code with the text stored in the Testing messages tab, to the body of the request.
{ "pixel_id": "#{pixel_id}", "access_token": "#{access_token}", "event_name": "Entered the bot", "event_source_url": "https://my_best_site.com", "fbp": "#{_fbp}", "fbс": "#{_fbс}", "test_event_code": "TEST11421" }
Attention! Don’t forget to delete this parameter from the request when launching the test version!
fn - first name ln - last name email - the client’s email phone - the client’s phone number fbc - click id gender - the client’s gender (f - female, m - male) country - self explanatory state - self explanatory city - self explanatory index - the client’s postal index (zip code) external_id - any unique client id, i.e. user id or id of third-party cookie files client_ip_address - the client’s IP address client_user_agent - user agent of the client’s browser
You can also transfer your own parameters into Pixel (optional), for this you need to add an additional parameter my_params and specify your own fields in it.
Example: “my_params”: {“value1”: “Hello”, “val2”: “Hi”}
{ "pixel_id": "#{pixel_id}", "access_token": "#{access_token}", "event_name": "Entered the bot", "event_source_url": "https://my_best_site.com", "email": "test@test.com", "phone": "1234567890", "currency": "USD", "value": "142.52", "test_event_code": "TEST11421", "external_id": "#{client_id}", "fn": "#{name}", "gender": "m", "post_index": "12345", "my_params": {“value1”: “Hello”, “val2”: “Hi”} }
Attention! Don’t forget to delete this parameter from the request when launching the test version!
First, you need to open access to your account
Save and move to the tab Related Objects -> Add Objects
And then add your promotional account