-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGoogleAnalyticsTags.php
More file actions
executable file
·39 lines (31 loc) · 1.34 KB
/
GoogleAnalyticsTags.php
File metadata and controls
executable file
·39 lines (31 loc) · 1.34 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
<?php
namespace Statamic\Addons\GoogleAnalytics;
use Statamic\Extend\Tags;
use Statamic\API\User;
class GoogleAnalyticsTags extends Tags
{
/**
* The {{ google_analytics }} tag
*
* @return string|array
*/
public function index()
{
$tracking_id = str_replace(' ', '', $this->getConfig('tracking_id', ''), $value);
if (!empty($tracking_id))
{
$display_features = $this->getConfig('display_features', false);
$async = $this->getConfig('async', false);
$link_id = $this->getConfig('link_id', false);
$beacon = $this->getConfig('beacon', false);
$track_uid = $this->getConfig('track_uid', false);
$ignore_admins = $this->getConfig('ignore_admins', false);
$user = $track_uid ? User::getCurrent() : false;
$debug = $this->getConfig('debug', false);
$trace_debugging = $this->getConfig('trace_debugging', false);
$disable_sending = $this->getConfig('disable_sending', false);
return $this->view('tracking-code', compact('tracking_id', 'async', 'display_features', 'link_id', 'beacon', 'track_uid', 'ignore_admins', 'user', 'debug', 'trace_debugging', 'disable_sending'))->render();
}
return '<!-- Google Analytics Tracking code is not setup yet! -->';
}
}