# Facebook Pixel

* [How to use Facebook Pixel in mini-landings ](#how-to-use-facebook-pixel-in-mini-landings)
* [How to send events to Pixel from the bot](#how-to-send-events-to-pixel-from-the-bot)&#x20;
* [How to add a promotional account](#how-to-add-a-promotional-account)

## How to use Facebook Pixel in mini-landings

{% embed url="<https://docs.salebot.ai/mini-landing#how-to-use-social-networking-pixels>" %}

## How to send events to Pixel from the bot

To transfer events from the bot’s workflow, you need to have a business account. You can register [here](https://business.facebook.com)

### How to create a new pixel

![](/files/bI5R3w7pxP4qAZLEaIU9)

Choose API Conversions

![](/files/MjvweUO5ut7XPL0dgJEI)

{% hint style="danger" %}
**Attention!** If the following window opens up during the conversion API configuration, it’s better to leave the settings and start again.
{% endhint %}

![If the following window opens up during the conversion API configuration, it’s better to leave the settings and start again.](/files/zzAcweViAtmW9i0vlU2c)

![](/files/TAYQhSRMkBRiXHJ7X3Qp)

Choose the Pixel you need

![](/files/fzYTC3uoqqDSyK7in08u)

Generate an access token and save it in a safe space.

![](/files/9REobOmaZtEASopRlAR0)

### How to transfer events to Facebook

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:

![](https://lh4.googleusercontent.com/qu2QVQQLtGctNi1CWSeDJS7XmZCsYmbe7oEVukfSbjhFNCaY-XoymKBy1K3Gc8xk44mShIMGLjzhjS-4o07Pq_EpoWVhwOAxD9BTN8z1IyKXUfnfxyio-NEHcK1XkTOe1CcOzJwkPxgk7yeHSg)

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

![](https://lh3.googleusercontent.com/RtPgefjbjtWeLOq5Dx9BECYp49TBwg0YjXpxzIqa93NOzoxWQY46PyIy1YFhCUJQbbhhwD9_5otW9nbm_5rBRVdxj8HfnIxb3VHDpkA9TwMo2p8D8JgV-MnT_4ZeptPxcyVJ0JHILNBNpulkcA)

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}" \
}

#### Mandatory parameters:

**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**](https://developers.facebook.com/docs/facebook-pixel/implementation/conversion-tracking/#standard-events)), as well as your own (like Entered the bot) \
**event\_source\_url** - the approved on Facebook domain \
**fbp** - the client’s browser id

![](https://lh6.googleusercontent.com/hinCfhykXn0MlIWNs-To3nCggwTierkrQrY_IK5eefY3J-3-Yi5f16yeTfKaqO57fC_MhXmw_VKhiXRQV06ofie0gvZvTk4hntGdB9XZb-D4hx53OBlTWMQyuPFdJcEyc5btcqWP6hCsiekvBA)

#### Optional parameters:

**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:

| Value              | Description                                                                           |
| ------------------ | ------------------------------------------------------------------------------------- |
| `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                                                       |

### How to test events

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.

![](/files/pqWIQHeB1gHh5hI8ysJB)

{ \
"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" \
}

{% hint style="warning" %}
**Attention!** Don’t forget to delete this parameter from the request when launching the test version!
{% endhint %}

#### Additional optional parameters:

**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”}

#### Full example:

{ \
"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”} \
}

{% hint style="warning" %}
**Attention!** Don’t forget to delete this parameter from the request when launching the test version!
{% endhint %}

![](/files/lUZ4gqXUeMSK3HReOwMe)

## How to add a promotional account

First, you need to open access to your account

![](/files/Ey84aZpkialaH73c6AqS)

![](/files/73QBHFaWegUbU0apTVBT)

Save and move to the tab Related Objects -> Add Objects

![](/files/HjIURtUv6A1ngGT7ZXCQ)

And then add your promotional account


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mavibot.ai/integrations/other/analytics/pixel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
