1 | <?php |
||
2 | /** |
||
3 | * Instant Analytics plugin for Craft CMS |
||
4 | * |
||
5 | * Instant Analytics brings full Google Analytics support to your Twig templates |
||
6 | * |
||
7 | * @link https://nystudio107.com |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
8 | * @copyright Copyright (c) 2017 nystudio107 |
||
0 ignored issues
–
show
|
|||
9 | */ |
||
0 ignored issues
–
show
|
|||
10 | |||
11 | /** |
||
12 | * Instant Analytics GA4 config.php |
||
13 | * |
||
14 | * This file exists only as a template for the Instant Analytics settings. |
||
15 | * It does nothing on its own. |
||
16 | * |
||
17 | * Don't edit this file, instead copy it to 'craft/config' as 'instant-analytics.php' |
||
18 | * and make your changes there to override default settings. |
||
19 | * |
||
20 | * Once copied to 'craft/config', this file will be multi-environment aware as |
||
21 | * well, so you can have different settings groups for each environment, just as |
||
22 | * you do for 'general.php' |
||
23 | */ |
||
24 | |||
25 | return [ |
||
26 | /** |
||
27 | * The default Google Analytics measurement ID used by GA4. |
||
28 | */ |
||
29 | 'googleAnalyticsMeasurementId' => '', |
||
30 | |||
31 | /** |
||
32 | * The default Google Analytics measurement API secret used by GA4. |
||
33 | */ |
||
34 | 'googleAnalyticsMeasurementApiSecret' => '', |
||
35 | |||
36 | /** |
||
37 | * Should the query string be stripped from the page tracking URL? |
||
38 | */ |
||
39 | 'stripQueryString' => true, |
||
40 | |||
41 | /** |
||
42 | * Should page views be sent automatically when a page view happens? |
||
43 | */ |
||
44 | 'autoSendPageView' => true, |
||
45 | |||
46 | /** |
||
47 | * If you plan to use Instant Analytics in conjunction with frontend JavaScript, this setting should be on, so that Instant Analytics requires a `clientId` from the frontend-set GA cookie before it will send analytics data. |
||
48 | */ |
||
49 | 'requireGaCookieClientId' => true, |
||
50 | |||
51 | /** |
||
52 | * Should the GCLID cookie be created if it doesn't exist? |
||
53 | */ |
||
54 | 'createGclidCookie' => true, |
||
55 | |||
56 | /** |
||
57 | * The field in a Commerce Product Variant that should be used for the category |
||
58 | */ |
||
59 | 'productCategoryField' => '', |
||
60 | |||
61 | /** |
||
62 | * The field in a Commerce Product Variant that should be used for the brand |
||
63 | */ |
||
64 | 'productBrandField' => '', |
||
65 | |||
66 | /** |
||
67 | * Whether add to cart events should be automatically sent |
||
68 | */ |
||
69 | 'autoSendAddToCart' => true, |
||
70 | |||
71 | /** |
||
72 | * Whether remove from cart events should be automatically sent |
||
73 | * |
||
74 | * @var bool |
||
75 | */ |
||
76 | 'autoSendRemoveFromCart' => true, |
||
77 | |||
78 | /** |
||
79 | * Whether purchase complete events should be automatically sent |
||
80 | */ |
||
81 | 'autoSendPurchaseComplete' => true, |
||
82 | |||
83 | /** |
||
84 | * Controls whether Instant Analytics will send analytics data. |
||
85 | */ |
||
86 | 'sendAnalyticsData' => true, |
||
87 | |||
88 | /** |
||
89 | * Controls whether Instant Analytics will send analytics data when `devMode` is on. |
||
90 | */ |
||
91 | 'sendAnalyticsInDevMode' => true, |
||
92 | |||
93 | /** |
||
94 | * Controls whether we should filter out bot UserGents. |
||
95 | */ |
||
96 | 'filterBotUserAgents' => true, |
||
97 | |||
98 | /** |
||
99 | * Controls whether we should exclude users logged into an admin account from Analytics tracking. |
||
100 | */ |
||
101 | 'adminExclude' => false, |
||
102 | |||
103 | /** |
||
104 | * Controls whether analytics that blocked from being sent should be logged to |
||
105 | * storage/logs/web.log |
||
106 | * These are always logged if `devMode` is on |
||
107 | */ |
||
108 | 'logExcludedAnalytics' => true, |
||
109 | |||
110 | /** |
||
111 | * Contains an array of Craft user group handles to exclude from Analytics tracking. If there's a match |
||
112 | * for any of them, analytics data is not sent. |
||
113 | */ |
||
114 | 'groupExcludes' => array( |
||
115 | 'some_user_group_handle', |
||
116 | ), |
||
117 | |||
118 | /** |
||
119 | * Contains an array of keys that correspond to $_SERVER[] super-global array keys to test against. |
||
120 | * Each item in the sub-array is tested against the $_SERVER[] super-global key via RegEx; if there's |
||
121 | * a match for any of them, analytics data is not sent. This allows you to filter based on whatever |
||
122 | * information you want. |
||
123 | * Reference: http://php.net/manual/en/reserved.variables.server.php |
||
124 | * RegEx tester: http://regexr.com |
||
125 | */ |
||
126 | 'serverExcludes' => array( |
||
127 | 'REMOTE_ADDR' => array( |
||
128 | '/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/', |
||
129 | ), |
||
130 | ), |
||
131 | ]; |
||
132 |