PHPackages                             berno/pff2-fb-conversion-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. berno/pff2-fb-conversion-api

ActivePff2-module[API Development](/categories/api)

berno/pff2-fb-conversion-api
============================

Module to manage facebook conversion api

v1.0.2(3y ago)517MITPHP

Since Sep 2Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Berno/pff2-fb-conversion-api)[ Packagist](https://packagist.org/packages/berno/pff2-fb-conversion-api)[ Docs](https://github.com/berno/pff2-fb-conversion-api)[ RSS](/packages/berno-pff2-fb-conversion-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

Pff2 Facebook conversion Api
============================

[](#pff2-facebook-conversion-api)

Request common parameters
-------------------------

[](#request-common-parameters)

The basic request sent to the facebook api:

```
{
   "data": [
      {
         "event_name": "",
         "event_time": 54545454,
         "event_source_url": "",
         "action_source": "website",
         "user_data": {
            "client_ip_address": "",
            "client_user_agent": "",
            "fbp": "",
            "fbc": ""
         },
         "custom_data": {}
      }
   ],
   "test_event_code": ""
}
```

- `event_name` is based on the event and set by the specific method called.
- `event_time` is set with the current timestamp value
- `event_source_url` is set with the $event\_source\_url parameter, if it is not specified is replaced with the current request url by default.
- `client_ip_address` is set with the `$_SERVER['REMOTE_ADDR']` value
- `client_user_agent` is set with the `$_SERVER['HTTP_USER_AGENT']` value
- `fbp` is set with the `$_COOKIE['_fbp']` cookie value if it's present
- `fbc` is set with the `$_COOKIE['_fbc']` cookie value if it's present
- `custom_data` depends on the specific event sent, see the event specific documentation.
- `test_event_code` is present only if the debug config param is not false

Events
------

[](#events)

The facebook pixel events managed by the module are:

### PageView

[](#pageview)

To send a PageView event create an action in a controller in which you call `sendPageViewEvent()`:

```
public function pageViewTrigger() {
    $this->resetViews();
    /** @var Pff2FbConversionApi $fb_conv_api */
    $fb_conv_api = ModuleManager::loadModule('pff2-fb-conversion-api');
    $fb_conv_api->sendPageViewEvent();
}
```

Insert a render action in the main layout which refers to the action created (for ex. in the Layout\_Controller)

```

```

This method does not create a custom data request field.

### CompleteRegistration

[](#completeregistration)

```
sendCompleteRegistrationEvent($event_source_url, $user_email, $status)
```

- `string|null $event_source_url` The browser URL where the event happened. The URL must begin with http:// or https:// and should match the verified domain. If `null` the parameter value is replaced with the absolute url of the request.
- `string|null $user_email` User email, if specified it has added to the `user_data` request field.
- `string $status` The status of the registration event, as a string. Example: 'registered'.

example of custom data created:

```
"custom_data": {
    "status": "registered"
}
```

### InitiateCheckout

[](#initiatecheckout)

```
sendInitiateCheckoutEvent($event_source_url, $user_email, $value, $currency = "EUR")
```

- `string|null $event_source_url` The browser URL where the event happened. The URL must begin with http:// or https:// and should match the verified domain. If `null` the parameter value is replaced with the absolute url of the request.
- `string|null` User email, if specified it has added to the `user_data` request field.
- `float $value` The total of order when the checkout process begins
- `string` $currency The currency for the $value specified. Currency must be a valid ISO 4217 three digit currency code. Example: 'EUR'.

example of custom data created:

```
"custom_data": {
    "currency": "EUR",
    "value": 100
}
```

### ViewContent

[](#viewcontent)

```
sendViewContentEvent($event_source_url, $user_email, $content_name, $content_ids, $value, $currency = "EUR")
```

- `string|null $event_source_url` The browser URL where the event happened. The URL must begin with http:// or https:// and should match the verified domain. If `null` the parameter value is replaced with the absolute url of the request.
- `string|null` User email, if specified it has added to the `user_data` request field.
- `string $content_name` The name of the page or product associated with the event.
- `[string] $content_ids` The content IDs associated with the event in the form \['ABC','123'\]
- `float $value` A numeric value associated with this event.
- `string $currency` The currency for the $value specified. Currency must be a valid ISO 4217 three digit currency code. Example: 'EUR'.

example of custom data created:

```
"custom_data": {
    "currency": "EUR",
    "value": 60.00,
    "content_type": "product",
    "content_name": "Name of the product",
    "content_ids": ["123"]
}
```

### AddToCart

[](#addtocart)

```
sendAddToCartEvent($event_source_url, $user_email, $contents, $value, $currency = "EUR")
```

- `string|null $event_source_url` The browser URL where the event happened. The URL must begin with http:// or https:// and should match the verified domain. If `null` the parameter value is replaced with the absolute url of the request.
- `string|null` User email, if specified it has added to the `user_data` request field.
- `[array] $contents` array of associative arrays `[array("id" => , "quantity" => )]`
- `float $value` Total cost of the item added (price \* quantity).
- `string $currency` The currency for the $value specified. Currency must be a valid ISO 4217 three digit currency code. Example: 'EUR'.

example of custom data created:

```
"custom_data": {
    "value": 100.2,
    "currency": "EUR",
    "contents": [
       {"id": "123", "quantity": 1},
       {"id": "234", "quantity": 3}
    ],
    "content_type": "product"
}
```

### Purchase

[](#purchase)

```
sendPurchaseEvent($event_source_url, $user_email, $content_ids, $order_value, $currency = "EUR")
```

- `string|null $event_source_url` The browser URL where the event happened. The URL must begin with http:// or https:// and should match the verified domain. If `null` the parameter value is replaced with the absolute url of the request.
- `string|null` User email, if specified it has added to the `user_data` request field.
- `[string] $content_ids` The content IDs associated with the event in the form `['ABC','123']`.
- `float $order_value` Total order amount
- `string $currency` The currency for the $order\_value specified. Currency must be a valid ISO 4217 three digit currency code. Example: 'EUR'.

example of custom data created:

```
"custom_data": {
    "currency": "EUR",
    "value": 123.45,
    "content_type": "product",
    "content_ids": ["123","234"]
}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~187 days

Total

4

Last Release

1155d ago

Major Versions

v1.0.0 → 3.0.x-dev2021-09-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e0586c193ae0a3d19ef1b62b39e64e29eee3001978f627cb247fadc5db5d248?d=identicon)[Berno](/maintainers/Berno)

---

Tags

facebookmodulepff2conversion api

### Embed Badge

![Health badge](/badges/berno-pff2-fb-conversion-api/health.svg)

```
[![Health](https://phpackages.com/badges/berno-pff2-fb-conversion-api/health.svg)](https://phpackages.com/packages/berno-pff2-fb-conversion-api)
```

###  Alternatives

[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[facebook/php-ads-sdk

PHP SDK for Facebook Business

9014.1M8](/packages/facebook-php-ads-sdk)[nickdnk/graph-sdk

Facebook SDK for PHP 8+

452.0M6](/packages/nickdnk-graph-sdk)[janu-software/facebook-php-sdk

Alternative toolkit for Facebook Graph API

71684.8k2](/packages/janu-software-facebook-php-sdk)[joelbutcher/facebook-graph-sdk

Facebook SDK for PHP

42728.5k1](/packages/joelbutcher-facebook-graph-sdk)[kerox/messenger

PHP Library to interact with Facebook Messenger Platform

58302.1k1](/packages/kerox-messenger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
