You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* The Conversions API comes with a nice way to test your events.
37
+
* You may use this config variable to set your test code.
38
+
*/
39
+
'test_code' => null,
40
+
];
41
+
```
42
+
43
+
## Conversions API
44
+
45
+
This package allows you to set the user data and events that will be sent to the Conversions API.
46
+
```php
47
+
use Esign\ConversionsApi\Facades\ConversionsApi;
48
+
use FacebookAds\Object\ServerSide\UserData;
49
+
use FacebookAds\Object\ServerSide\Event;
50
+
51
+
ConversionsApi::setUserData(
52
+
(new UserData())->setFirstName('John')->setLastName('Doe')
53
+
);
54
+
ConversionsApi::setEvent(
55
+
(new Event())->setEventName('PageView')->setEventId('abc')
56
+
);
57
+
```
58
+
59
+
To actually send the data you must call the `execute` method.
60
+
```php
61
+
use Esign\ConversionsApi\Facades\ConversionsApi;
62
+
63
+
ConversionsApi::execute();
64
+
```
65
+
66
+
This package also comes with a nice helper to send `PageView` events.
67
+
By including the `@conversionsApiPageView` directive on a page, an event with the minimum required data (ip address, user agent and request url) will be sent to the Conversions API:
68
+
```php
69
+
@conversionsApiPageView
70
+
```
71
+
72
+
###
73
+
74
+
## Facebook Pixel
75
+
To [deduplicate browser and server events](https://developers.facebook.com/docs/marketing-api/conversions-api/deduplicate-pixel-and-server-events/) this package will automatically generate a unique event ID for every request.
76
+
This event ID should be passed along with your Facebook Pixel.
77
+
This package comes with a few ways to do this:
78
+
79
+
### Facebook Pixel
80
+
In case you want to directly load the Facebook Pixel script you may use the `@conversionsApiFacebookPixelScript` directive or directly include it.
0 commit comments