PluginProbe ʕ •ᴥ•ʔ
ShareThis Dashboard for Google Analytics / 3.0.0
ShareThis Dashboard for Google Analytics v3.0.0
3.3.2 trunk 1.0.7 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.5 2.3.5 2.3.6 2.3.7 2.3.8 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 3.0.0 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.3.0 3.3.1
googleanalytics / view / ga-ga4-settings.php
googleanalytics / view Last commit date
templates 3 years ago ga-accounts-selector.php 4 years ago ga-auth-button.php 4 years ago ga-code.php 4 years ago ga-dashboard-widget.php 4 years ago ga-debug-modal.php 4 years ago ga-ga4-settings.php 3 years ago ga-googleanalytics-loader.php 4 years ago ga-notice.php 3 years ago ga-oauth-notice.php 4 years ago ga-wp-notice.php 4 years ago page.php 3 years ago statistics.php 3 years ago stats.php 3 years ago trending.php 4 years ago
ga-ga4-settings.php
254 lines
1 <?php
2 $ga4_exclude_roles = true === is_array($ga4_exclude_roles) ? $ga4_exclude_roles : [];
3 ?>
4 <script type="text/javascript">
5 const GA_NONCE = '<?php echo esc_js( $ga_nonce ); ?>';
6 const GA_NONCE_FIELD = 'ga4-setup';
7 </script>
8 <div class="settings-wrap setup-wrap<?php echo true === $setup_done ? ' hide' : ''; ?>">
9 <?php $auth_info = Ga_Admin::getGa4AuthInfo(); ?>
10 <div class="ga-step ga-step-1<?php echo false === $has_code && false === $has_property ? ' engage' : ''; ?>">
11 <div class="ga-steps">
12 1 of 3
13 <div class="ga-dots"><span class="dark-green"></span> </div>
14 </div>
15 <h2>Setup Google Authentication</h2>
16 <p>Use our configuration wizard to properly setup Google Analytics with Wordpress (with just a few clicks).</p>
17 <a id="google-auth-link" href="<?php echo esc_url($auth_info['auth_url']); ?>">
18 <img src="<?php echo plugins_url() . '/googleanalytics/assets/images/Google-logo.svg'; ?>" alt="Google Logo">Sign in with Google
19 </a>
20 </div>
21 <div class="ga-step ga-step-2<?php echo false !== $has_code && false === $has_property ? ' engage' : ''; ?>">
22 <div class="ga-steps">
23 2 of 3
24 <div class="ga-dots">• <span class="dark-green">•</span> •</div>
25 </div>
26 <h2>Select Account Property</h2>
27 <p>Choose the view you want to use for your reports.</p>
28 <label for="ga4-property">
29 <select id="ga4-property">
30 <option>Choose Property</option>
31 <?php foreach($auth_info['properties'] as $account => $properties) :
32 if (false === empty($properties)) : ?>
33 <option disabled><?php echo esc_html($account); ?>:</option>
34 <?php foreach ($properties as $property) : ?>
35 <option value="<?php echo esc_attr($property['name'] ); ?>"><?php echo esc_html($property['displayName'] ); ?></option>
36 <?php endforeach; endif; endforeach;?>
37 </select>
38 </label>
39 <a id="to-step-3">Next</a>
40 </div>
41 <div class="ga-step ga-step-3<?php echo false === $setup_done && false !== $has_code && false !== $has_property ? ' engage' : ''; ?>">
42 <div class="ga-steps">
43 3 of 3
44 <div class="ga-dots">• • <span class="dark-green">•</span></div>
45 </div>
46 <div class="extra-settings">
47 <h2>Settings</h2>
48 <div class="ga-row">
49 <div class="ua-dual-settings">
50 <div class="ga-ua-col">
51 <h2>If using Google Optimize, enter optimize code here</h2>
52 <label>
53 <input id="ga4-google-optimize" type="text" placeholder="GMT-XXXXXX" value="">
54 </label>
55
56 <h2>Exclude Tracking for Roles</h2>
57 <div class="ga-exclude-roles">
58 <div class="switch">
59 <label class="item">
60 <input type="checkbox" value="administrator">
61 <span class="lever"></span>
62 Administrator
63 </label>
64 </div>
65 <div class="switch">
66 <label class="item">
67 <input type="checkbox" value="contributor">
68 <span class="lever"></span>
69 Contributor
70 </label>
71 </div>
72 <div class="switch">
73 <label class="item">
74 <input type="checkbox" value="editor">
75 <span class="lever"></span>
76 Editor
77 </label>
78 </div>
79 <div class="switch">
80 <label class="item">
81 <input type="checkbox" value="subscriber">
82 <span class="lever"></span>
83 Subscriber
84 </label>
85 </div>
86 <div class="switch">
87 <label class="item">
88 <input type="checkbox" value="author">
89 <span class="lever"></span>
90 Author
91 </label>
92 </div>
93 </div>
94 </div>
95 <div class="ga-ua-col">
96 <div class="switch">
97 <label class="item">
98 Enable Demographics
99 <input id="ga4-enable-demo" type="checkbox">
100 <span class="lever"></span>
101 </label>
102 </div>
103 <div class="switch">
104 <label class="item">
105 Enable IP Anonymization
106 <input type="checkbox" id="ga4-enable-ip-anon">
107 <span class="lever"></span>
108 </label>
109 </div>
110 <div class="switch">
111 <label class="item">
112 Enable GDPR Consent Management Tool
113 <input type="checkbox" id="ga4-enable-gdpr">
114 <span class="lever"></span>
115 </label>
116 </div>
117 </div>
118 </div>
119 </div>
120 <a id="complete-ga4-setup" class="green-button" href="<?php echo get_admin_url(); ?>admin.php?page=googleanalytics">Complete and go to dashboard</a>
121 </div>
122 </div>
123 </div>
124
125 <div style="margin-top: 0;<?php echo true === $setup_done ? '' : ' display: none;'; ?>" class="ga4_container ga_container">
126 <?php if ( false === empty( $data['error_message'] ) ) : ?>
127 <?php echo wp_kses_post( $data['error_message'] ); ?>
128 <?php endif; ?>
129 <h1>Google Analytics 4 - Settings</h1>
130 <form id="ga4_form" method="post" action="options.php">
131 <?php settings_fields( 'googleanalyticsga4' ); ?>
132 <table class="form-table">
133 <tr>
134 <?php if ( false === empty( $data['popup_url'] ) ) : ?>
135 <th scope="row">
136 <label class="<?php echo esc_attr( false === Ga_Helper::are_features_enabled() ? 'label-grey ga-tooltip"' : '' ); ?>">
137 <?php esc_html_e( 'Google Profile' ); ?>:
138 <span class="ga-tooltiptext ga-tt-abs"><?php echo esc_html( $tooltip ); ?></span>
139 </label>
140 </th>
141 <?php endif; ?>
142 </tr>
143 <?php if ( false === empty( $auth_info['properties'] ) ) : ?>
144 <tr>
145 <td>
146 <select id="ga_account_selector" name="googleanalytics-ga4-property">
147 <option>Please select your Google Analytics account:</option>
148 <?php foreach($auth_info['properties'] as $account => $properties) :
149 if (false === empty($properties)) : ?>
150 <option disabled><?php echo esc_html($account); ?>:</option>
151 <?php foreach ($properties as $property) : ?>
152 <option value="<?php echo esc_attr($property['name'] ); ?>" <?php echo $property['name'] === $has_property ? 'selected' : ''; ?>>
153 <?php echo esc_html($property['displayName'] ); ?>
154 </option>
155 <?php endforeach; endif; endforeach;?>
156 </select>
157 </td>
158 <td>
159 <button id="ga4_sign_out" class="button-secondary" type="button">
160 <?php esc_html_e( 'Sign out', 'googleanalytics' ); ?>
161 </button>
162 </td>
163 </tr>
164 <?php endif; ?>
165 <tr id="ga_roles_wrapper">
166 <th scope="row">
167 <label class="<?php echo esc_attr( false === Ga_Helper::are_features_enabled() ? 'label-grey ga-tooltip' : '' ); ?>">
168 <?php esc_html_e( 'Exclude Tracking for Roles' ); ?>
169 :
170 <span class="ga-tooltiptext ga-tt-abs"><?php echo esc_html( $tooltip ); ?></span>
171 </label>
172 </th>
173 </tr>
174 <tr>
175 <td>
176 <?php
177 if ( false === empty( $data['roles'] ) && true === is_array($ga4_exclude_roles)) {
178 $roles = $data['roles'];
179 foreach ( $roles as $role_item ) {
180 $role_id = true === isset($role_item['id']) ? $role_item['id'] : '';
181 $role_name = true === isset($role_item['name']) ? $role_item['name'] : '';
182 ?>
183 <div class="checkbox">
184 <label class="ga_checkbox_label <?php echo esc_attr(false === Ga_Helper::are_features_enabled() ? 'label-grey ga-tooltip' : ''); ?>"
185 for="checkbox_<?php echo esc_attr( $role_id ); ?>">
186 <input id="checkbox_<?php echo esc_attr( $role_id ); ?>" type="checkbox"
187 <?php echo disabled(false === Ga_Helper::are_features_enabled()); ?>
188 name="googleanalytics-ga4-exclude-roles[<?php echo esc_attr(str_replace('role-id-', '', $role_id)); ?>]"
189 id="<?php echo esc_attr( $role_id ); ?>"
190 <?php echo esc_attr( ( true === in_array(str_replace('role-id-', '', $role_id), array_keys($ga4_exclude_roles), true) ? 'checked="checked"' : '' ) ); ?> />&nbsp;
191 <?php echo esc_html( $role_name ); ?>
192 <span class="ga-tooltiptext"><?php echo esc_html( $tooltip ); ?></span>
193 </label>
194 </div>
195 <?php
196 }
197 }
198 ?>
199 </td>
200 </tr>
201 <tr>
202 <th scope="row"><?php esc_html_e( 'Enable IP Anonymization' ); ?>:</th>
203 </tr>
204 <tr>
205 <td>
206 <label class="ga-switch <?php echo esc_attr(false === Ga_Helper::are_features_enabled() ? 'label-grey ga-tooltip' : ''); ?>">
207 <?php if ( true === Ga_Helper::are_features_enabled() ) : ?>
208 <input id="ga-anonymization" name="googleanalytics-ga4-ip-anon"
209 type="checkbox" <?php echo checked( $ga4_ip, 'on' ); ?>>
210
211 <div id="ga-slider" class="ga-slider round"></div>
212 <?php else : ?>
213 <input id="ga-anonymization" name="googleanalytics-ga4-ip-anon"
214 type="checkbox" disabled="disabled">
215
216 <div id="ga-slider" class="ga-slider round"></div>
217 <span class="ga-tooltiptext ga-tt-abs"><?php echo esc_html( $tooltip ); ?></span>
218 <?php endif; ?>
219 </label>
220 </td>
221 </tr>
222 <tr>
223 <td>
224 <input name="googleanalytics-ga4-demo" value="<?php echo esc_attr($ga4_demo); ?>" type="hidden">
225 </td>
226 </tr>
227 <tr>
228 <th scope="row"><?php esc_html_e( 'If using Google Optimize, enter optimize code here' ); ?>:</th>
229 </tr>
230 <tr>
231 <td>
232 <label class="ga-text <?php echo esc_attr( false === Ga_Helper::are_features_enabled() ? 'label-grey ga-tooltip' : '' ); ?>">
233 <?php if ( true === Ga_Helper::are_features_enabled() ) : ?>
234 <input id="ga-optimize" name="googleanalytics-ga4-optimize"
235 type="text" placeholder="GTM-XXXXXX"
236 value="<?php echo esc_attr( $ga4_optimize ); ?>">
237 <?php else : ?>
238 <input id="ga-optimize" name="googleanalytics-ga4-optimize"
239 type="text" placeholder="GTM-XXXXXX"
240 value="<?php echo esc_attr( $ga4_optimize ); ?>" readonly>
241 <span class="ga-tooltiptext ga-tt-abs"><?php echo esc_html( $tooltip ); ?></span>
242 <?php endif; ?>
243 </label>
244 </td>
245 </tr>
246 <?php require $plugin_dir . 'templates/gdpr.php'; ?>
247 </table>
248
249 <p class="submit">
250 <input type="submit" class="button-primary" value="<?php esc_html_e( 'Save Changes' ); ?>"/>
251 </p>
252 </form>
253 </div>
254