-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathFacebookPixel.php
More file actions
41 lines (38 loc) · 1.22 KB
/
FacebookPixel.php
File metadata and controls
41 lines (38 loc) · 1.22 KB
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
34
35
36
37
38
39
40
41
<?php
namespace Silverstripe\CSP\Fragments;
use Silverstripe\CSP\Directive;
use Silverstripe\CSP\Fragments\Fragment;
use Silverstripe\CSP\Policies\Policy;
/**
* This allows you to have a Facebook pixel related resources
*/
class FacebookPixel implements Fragment
{
public static function addTo(Policy $policy): void
{
$policy
->addDirective(Directive::SCRIPT, [
'https://connect.facebook.net',
'https://www.facebook.com',
])
->addDirective(Directive::SCRIPT_ELEM, [
'https://connect.facebook.net',
'https://www.facebook.com',
])
->addDirective(Directive::CONNECT, [
'https://connect.facebook.net',
'https://www.facebook.com',
'https://www.instagram.com',
])
->addDirective(Directive::FRAME, [
'https://www.facebook.com',
])
->addDirective(Directive::FORM_ACTION, [
'https://www.facebook.com/tr/',
])
->addDirective(Directive::IMG, [
'https://connect.facebook.net',
'https://www.facebook.com',
]);
}
}