-
Notifications
You must be signed in to change notification settings - Fork 12
/
DataLayerUserDataVariable.php
33 lines (28 loc) · 1.21 KB
/
DataLayerUserDataVariable.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
namespace Esign\ConversionsApi\View\Components;
use Esign\ConversionsApi\Contracts\MapsToDataLayer;
use Esign\ConversionsApi\Facades\ConversionsApi;
class DataLayerUserDataVariable extends DataLayerVariable implements MapsToDataLayer
{
public function __construct()
{
parent::__construct($this);
}
public function getDataLayerArguments(): array
{
$userData = ConversionsApi::getUserData();
return array_filter([
'conversionsApiUserEmail' => $userData->getEmail(),
'conversionsApiUserFirstName' => $userData->getFirstName(),
'conversionsApiUserLastName' => $userData->getLastName(),
'conversionsApiUserPhone' => $userData->getPhone(),
'conversionsApiUserExternalId' => $userData->getExternalId(),
'conversionsApiUserGender' => $userData->getGender(),
'conversionsApiUserDateOfBirth' => $userData->getDateOfBirth(),
'conversionsApiUserCity' => $userData->getCity(),
'conversionsApiUserState' => $userData->getState(),
'conversionsApiUserZipCode' => $userData->getZipCode(),
'conversionsApiUserCountry' => $userData->getCountryCode(),
]);
}
}