Skip to content

Commit 889fdd9

Browse files
Update: polish docs
1 parent d019f83 commit 889fdd9

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,18 @@ This package also comes with a way to define default user data for the user of t
111111
You may do so by calling the `setUserData` method, this is typically done in your `AppServiceProvider`:
112112
```php
113113
use Esign\ConversionsApi\Facades\ConversionsApi;
114-
use FacebookAds\Object\ServerSide\UserData;
114+
use Esign\ConversionsApi\Objects\DefaultUserData;
115115

116116
ConversionsApi::setUserData(
117-
(new UserData())->setEmail(auth()->user()?->email)
117+
DefaultUserData::create()
118+
->setEmail(auth()->user()?->email)
118119
);
119120
```
120121

121122
You may now pass the user data along with your events:
122123
```php
123124
use Esign\ConversionsApi\Facades\ConversionsApi;
124-
use FacebookAds\Object\ServerSide\UserData;
125+
use FacebookAds\Object\ServerSide\Event;
125126

126127
ConversionsApi::addEvent(
127128
(new Event())->setUserData(ConversionsApi::getUserData())
@@ -280,11 +281,10 @@ ConversionsApi::setUserData(
280281
);
281282
```
282283
```js
283-
window.dataLayer.push({"conversionsApiEmail": "john@example.com"});
284+
window.dataLayer.push({"conversionsApiUserEmail": "john@example.com"});
284285
```
285286

286287
Now that your Pixel through GTM is correctly initialized, it's time to send some events.
287-
Sadly the parameters between the Conversions API and Facebook Pixel are not identical, so they must be mapped to the [correct format](https://developers.facebook.com/docs/meta-pixel/reference).
288288
An easy way of doing this is by extending the `FacebookAds\Object\ServerSide\Event` class and implementing the `Esign\ConversionsApi\Contracts\MapsToDataLayer` interface on it:
289289
```php
290290
use Esign\ConversionsApi\Contracts\MapsToDataLayer;

UPGRADING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ See the [docs](README.md#creating-event-classes) for an example on this.
1616
In case you're using the Facebook Pixel directly, use `<x-conversions-api-facebook-pixel-page-view />`.
1717
If you're sending them through Google Tag Manager, use `<x-conversions-api-data-layer-page-view />`.
1818
Note that the dataLayer variable name has been changed from `conversionsApiEventId` to `conversionsApiPageViewEventId`.
19-
- The `@conversionsApiFacebookPixelScript` directive has been replaced with `<x-conversions-api-facebook-pixel-script />`.
19+
- The `@conversionsApiFacebookPixelScript` directive has been replaced with `<x-conversions-api-facebook-pixel-script />`.
20+
- The `@conversionsApiDataLayer` has been removed. Support for dataLayer events is possible through `<x-conversions-api-data-layer-variable :event="$event" />` or `<x-conversions-api::data-layer-variable :arguments="[]" />`. See the [docs](README.md#google-tag-manager) for an example on this.

0 commit comments

Comments
 (0)