-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTikTokPixel.php
More file actions
34 lines (31 loc) · 902 Bytes
/
TikTokPixel.php
File metadata and controls
34 lines (31 loc) · 902 Bytes
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
<?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 TikTok Pixel.
*/
class TikTokPixel implements Fragment
{
public static function addTo(Policy $policy): void
{
$policy
->addDirective(Directive::FRAME, [
'bytedance:',
'sslocal:',
])
->addDirective(Directive::SCRIPT, [
'https://analytics.tiktok.com',
])
->addDirective(Directive::SCRIPT_ELEM, [
'https://analytics.tiktok.com',
])
->addDirective(Directive::CONNECT, [
'https://analytics.tiktok.com',
])
->addDirective(Directive::IMG, [
'https://analytics.tiktok.com',
]);
}
}