PluginProbe ʕ •ᴥ•ʔ
ShareThis Dashboard for Google Analytics / 3.1.6
ShareThis Dashboard for Google Analytics v3.1.6
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 / page.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
page.php
362 lines
1 <?php
2 /**
3 * Page view.
4 *
5 * @package GoogleAnalytics
6 */
7
8 $optimize_code = get_option( 'googleanalytics_optimize_code' );
9 $universal = get_option( 'googleanalytics_oauth_auth_token', false );
10 $universal = '' !== $universal;
11 $anonymization = get_option( 'googleanalytics_ip_anonymization', true );
12 $debug_mode = get_option( 'googleanalytics_enable_debug_mode', 'off' );
13 $gdpr_config = get_option( 'googleanalytics_gdpr_config' );
14 $sharethis_property = get_option( 'googleanalytics_sharethis_terms' );
15 $plugin_dir = plugin_dir_path( __FILE__ );
16 $plugin_uri = trailingslashit( get_home_url() ) . 'wp-content/plugins/googleanalytics/';
17 $has_code = filter_input(INPUT_GET, 'code');
18 $has_code = isset($has_code) ? $has_code : false;
19 $has_property = get_option('googleanalytics-ga4-property');
20 $has_property = isset($has_property) ? $has_property : false;
21 $ga4_optimize = get_option('googleanalytics-ga4-optimize');
22 $ga4_optimize = isset($ga4_optimize) ? $ga4_optimize : false;
23 $ga4_exclude_roles = get_option('googleanalytics-ga4-exclude-roles');
24 $ga4_exclude_roles = isset($ga4_exclude_roles) ? $ga4_exclude_roles : false;
25 $ga4_demo = get_option('googleanalytics-ga4-demo');
26 $ga4_demo = isset($ga4_demo) ? $ga4_demo : false;
27 $ga4_ip = get_option('googleanalytics-ga4-ip-anon');
28 $ga4_ip = isset($ga4_ip) ? $ga4_ip : false;
29 $ga4_gdpr = get_option('googleanalytics-ga4-gdpr');
30 $ga4_gdpr = isset($ga4_gdpr) ? $ga4_gdpr : false;
31 $ga_nonce = wp_create_nonce('ga4-setup');
32 $setup_done = false !== $has_property &&
33 (
34 false !== $ga4_gdpr ||
35 false !== $ga4_demo ||
36 false !== $ga4_exclude_roles ||
37 false !== $ga4_optimize ||
38 false !== $ga4_ip
39 );
40 ?>
41 <div id="adblocker-notice" class="notice notice-error is-dismissible">
42 <p>
43 <?php
44 esc_html_e(
45 'It appears you have an ad blocker enabled. To avoid affecting this plugin\'s functionality, please disable while using its admin configurations and registrations. Thank you.',
46 'googleanalytics'
47 );
48 ?>
49 </p>
50 </div>
51 <div id="detectadblock">
52 <div class="adBanner">
53 </div>
54 </div>
55 <div id="ga_access_code_modal" class="ga-modal" tabindex="-1">
56 <div class="ga-modal-dialog">
57 <div class="ga-modal-content">
58 <div class="ga-modal-header">
59 <span id="ga_close" class="ga-close">&times;</span>
60 <h4 class="ga-modal-title">
61 <?php esc_html_e( 'Please paste the access code obtained from Google below:' ); ?>
62 </h4>
63 </div>
64 <div class="ga-modal-body">
65 <div id="ga_code_error" class="ga-alert ga-alert-danger" style="display: none;"></div>
66 <label for="ga_access_code"><strong><?php esc_html_e( 'Access Code' ); ?></strong>:</label>
67 &nbsp;<input id="ga_access_code_tmp" type="text"
68 placeholder="<?php esc_html_e( 'Paste your access code here' ); ?>"/>
69 <div class="ga-loader-wrapper">
70 <div class="ga-loader"></div>
71 </div>
72 </div>
73 <div class="ga-modal-footer">
74 <button id="ga_btn_close" type="button" class="button">Close</button>
75 <button type="button" class="button-primary"
76 id="ga_save_access_code"
77 onclick="ga_popup.saveAccessCode( event )"><?php esc_html_e( 'Save Changes' ); ?></button>
78 </div>
79 </div><!-- /.modal-content -->
80 </div><!-- /.modal-dialog -->
81 </div><!-- /.modal -->
82 <?php echo wp_kses_post( $data['debug_modal'] ); ?>
83 <div class="wrap ga-wrap do-flex">
84 <div class="setting-tabs">
85 <div class="setting-tabs__tab ga4<?php echo false === $universal ? ' engage' : ''; ?>">
86 <?php esc_html_e('Google Analytics 4', 'googleanalytics'); ?>
87 </div>
88 <?php if ( false !== $universal ) : ?>
89 <div class="ua setting-tabs__tab engage">
90 <?php esc_html_e( 'Universal Analytics Settings', 'googleanalytics' ); ?>
91 </div>
92 <?php endif; ?>
93 </div>
94 <div class="ga4-settings-wrap setting-tab-content st-notice-there
95 <?php echo true === $setup_done ? ' normal-settings' : '';
96 echo false === $universal ? ' engage' : '';
97 ?>">
98 <?php include 'ga-ga4-settings.php'; ?>
99 </div>
100 <div class="ua-settings-wrap setting-tab-content<?php echo false !== $universal ? ' engage' : ''; ?>">
101 <h1>Universal Analytics - <?php esc_html_e( 'Settings', 'googleanalytics' ); ?></h1>
102 <?php if (false === $setup_done) : ?>
103 <button class="open-ga4">Setup Google Analytics 4</button>
104 <?php endif; ?>
105 <div style="margin-top: 0;" class="ga_container">
106 <?php if ( false === empty( $data['error_message'] ) ) : ?>
107 <?php echo wp_kses_post( $data['error_message'] ); ?>
108 <?php endif; ?>
109 <form id="ga_form" method="post" action="options.php">
110 <?php settings_fields( 'googleanalytics' ); ?>
111 <input id="ga_access_code" type="hidden"
112 name="<?php echo esc_attr( Ga_Admin::GA_OAUTH_AUTH_CODE_OPTION_NAME ); ?>" value=""/>
113 <table class="form-table">
114 <tr>
115 <?php if ( false === empty( $data['popup_url'] ) ) : ?>
116 <th scope="row">
117 <label class="<?php echo esc_attr( false === Ga_Helper::are_features_enabled() ? 'label-grey ga-tooltip"' : '' ); ?>">
118 <?php esc_html_e( 'Google Profile' ); ?>:
119 <span class="ga-tooltiptext ga-tt-abs"><?php echo esc_html( $tooltip ); ?></span>
120 </label>
121 </th>
122 <td <?php echo esc_attr( false === Ga_Helper::are_features_enabled() ? 'class="ga-tooltip"' : '' ); ?>>
123 <?php
124 echo wp_kses(
125 $data['auth_button'],
126 array(
127 'button' => array(
128 'class' => array(),
129 'id' => array(),
130 'onclick' => array(),
131 ),
132 )
133 );
134 ?>
135 <span class="ga-tooltiptext"><?php echo esc_html( $tooltip ); ?></span>
136 <?php if ( false === empty( $data[ Ga_Admin::GA_WEB_PROPERTY_ID_MANUALLY_OPTION_NAME ] ) ) : ?>
137 <div class="ga_warning">
138 <strong><?php esc_html_e( 'Notice' ); ?></strong>:&nbsp
139 <?php esc_html_e( 'Please uncheck the "Manually enter Tracking ID" option to authenticate and view statistics.' ); ?>
140 </div>
141 <?php endif; ?>
142 </td>
143 <?php endif; ?>
144
145 <?php if ( false === empty( $data['ga_accounts_selector'] ) ) : ?>
146 <th scope="row"><?php esc_html_e( 'Google Analytics Account' ); ?>:</th>
147 <?php endif; ?>
148 </tr>
149 <?php if ( false === empty( $data['ga_accounts_selector'] ) ) : ?>
150 <tr>
151 <td>
152 <?php
153 echo wp_kses(
154 $data['ga_accounts_selector'],
155 array(
156 'input' => array(
157 'name' => array(),
158 'type' => array(),
159 'value' => array(),
160 ),
161 'select' => array(
162 'id' => array(),
163 'name' => array(),
164 ),
165 'option' => array(
166 'value' => array(),
167 'selected' => array(),
168 ),
169 'optgroup' => array(
170 'label' => array(),
171 ),
172 )
173 );
174 ?>
175 </td>
176 <td>
177 <button id="ga_sign_out" class="button-secondary" type="button">
178 <?php esc_html_e( 'Sign out', 'googleanalytics' ); ?>
179 </button>
180 </td>
181 </tr>
182 <?php endif; ?>
183 <tr id="ga_roles_wrapper">
184 <th scope="row">
185 <label class="<?php echo esc_attr( false === Ga_Helper::are_features_enabled() ? 'label-grey ga-tooltip' : '' ); ?>">
186 <?php esc_html_e( 'Exclude Tracking for Roles' ); ?>
187 :
188 <span class="ga-tooltiptext ga-tt-abs"><?php echo esc_html( $tooltip ); ?></span>
189 </label>
190 </th>
191 </tr>
192 <tr>
193 <td>
194 <?php
195 if ( false === empty( $data['roles'] ) ) {
196 $roles = $data['roles'];
197 foreach ( $roles as $role_item ) {
198 ?>
199 <div class="checkbox">
200 <label class="ga_checkbox_label <?php echo esc_attr(false === Ga_Helper::are_features_enabled() ? 'label-grey ga-tooltip' : ''); ?>"
201 for="checkbox_<?php echo esc_attr( $role_item['id'] ); ?>">
202 <input id="checkbox_<?php echo esc_attr( $role_item['id'] ); ?>" type="checkbox"
203 <?php echo disabled( false === Ga_Helper::are_features_enabled() ); ?>
204 name="<?php echo esc_attr( Ga_Admin::GA_EXCLUDE_ROLES_OPTION_NAME . '[' . $role_item['id'] . ']' ); ?>"
205 id="<?php echo esc_attr( $role_item['id'] ); ?>"
206 <?php echo esc_attr( ( $role_item['checked'] ? 'checked="checked"' : '' ) ); ?> />&nbsp;
207 <?php echo esc_html( $role_item['name'] ); ?>
208 <span class="ga-tooltiptext"><?php echo esc_html( $tooltip ); ?></span>
209 </label>
210 </div>
211 <?php
212 }
213 }
214 ?>
215 </td>
216 </tr>
217 <tr>
218 <th scope="row"><?php esc_html_e( 'Enable IP Anonymization' ); ?>:</th>
219 </tr>
220 <tr>
221 <td>
222 <label class="ga-switch <?php echo esc_attr( ! Ga_Helper::are_features_enabled() ? 'label-grey ga-tooltip' : '' ); ?>">
223 <?php if ( true === Ga_Helper::are_features_enabled() ) : ?>
224 <input id="ga-anonymization" name="googleanalytics_ip_anonymization"
225 type="checkbox" <?php echo checked( $anonymization, 'on' ); ?>>
226
227 <div id="ga-slider" class="ga-slider round"></div>
228 <?php else : ?>
229 <input id="ga-anonymization" name="googleanalytics_ip_anonymization"
230 type="checkbox" disabled="disabled">
231
232 <div id="ga-slider" class="ga-slider round"></div>
233 <span class="ga-tooltiptext ga-tt-abs"><?php echo esc_html( $tooltip ); ?></span>
234 <?php endif; ?>
235 </label>
236 </td>
237 </tr>
238 <tr>
239 <th scope="row"><?php esc_html_e( 'If using Google Optimize, enter optimize code here' ); ?>:</th>
240 </tr>
241 <tr>
242 <td>
243 <label class="ga-text <?php echo esc_attr( false === Ga_Helper::are_features_enabled() ? 'label-grey ga-tooltip' : '' ); ?>">
244 <?php if ( true === Ga_Helper::are_features_enabled() ) : ?>
245 <input id="ga-optimize" name="googleanalytics_optimize_code"
246 type="text" placeholder="GTM-XXXXXX"
247 value="<?php echo esc_attr( $optimize_code ); ?>">
248 <?php else : ?>
249 <input id="ga-optimize" name="googleanalytics_optimize_code"
250 type="text" placeholder="GTM-XXXXXX"
251 value="<?php echo esc_attr( $optimize_code ); ?>" readonly>
252 <span class="ga-tooltiptext ga-tt-abs"><?php echo esc_html( $tooltip ); ?></span>
253 <?php endif; ?>
254 </label>
255 </td>
256 </tr>
257 <tr>
258 <th scope="row"><?php esc_html_e( 'Disable all features' ); ?>:</th>
259 </tr>
260 <tr>
261 <td>
262 <label class="ga-switch <?php echo esc_attr( ! Ga_Helper::are_features_enabled() ? 'label-grey ga-tooltip' : '' ); ?>">
263 <?php if ( true === Ga_Helper::are_features_enabled() ) : ?>
264 <input id="ga-disable"
265 name="<?php echo esc_attr( Ga_Admin::GA_DISABLE_ALL_FEATURES ); ?>"
266 type="checkbox">
267 <div id="ga-slider" class="ga-slider-disable ga-slider round"></div>
268 <?php else : ?>
269 <input id="ga-disable"
270 name="<?php echo esc_attr( Ga_Admin::GA_DISABLE_ALL_FEATURES ); ?>"
271 type="checkbox" disabled="disabled">
272 <div id="ga-slider" class="ga-slider-disable ga-slider round"></div>
273 <span class="ga-tooltiptext ga-tt-abs"><?php echo esc_html( $tooltip ); ?></span>
274 <?php endif; ?>
275 </label>
276 </td>
277 </tr>
278 <tr>
279 <th scope="row"><?php esc_html_e( 'Turn on GA Debugging' ); ?>:</th>
280 </tr>
281 <tr>
282 <td>
283 <label class="ga-switch <?php echo esc_attr( false === Ga_Helper::are_features_enabled() ? 'label-grey ga-tooltip' : '' ); ?>">
284 <?php if ( true === Ga_Helper::are_features_enabled() ) : ?>
285 <input id="ga-debugging" name="googleanalytics_enable_debug_mode"
286 type="checkbox" <?php echo checked( $debug_mode, 'on' ); ?>>
287 <div id="ga-slider" class="ga-slider round"></div>
288 <?php else : ?>
289 <input id="ga-debugging" name="googleanalytics_enable_debug_mode"
290 type="checkbox" disabled="disabled">
291 <div id="ga-slider" class="ga-slider round"></div>
292 <?php endif; ?>
293 </label>
294 <div class="ga_warning">
295 <strong><?php esc_html_e( 'WARNING' ); ?></strong>:&nbsp
296 <?php
297 esc_html_e(
298 'For debugging purposes only! Should NOT be used on live sites!',
299 'googleanalytics'
300 );
301 ?>
302 </div>
303 </td>
304 </tr>
305 <?php require $plugin_dir . 'templates/gdpr.php'; ?>
306 </table>
307
308 <p class="submit">
309 <input type="submit" class="button-primary"
310 value="<?php esc_html_e( 'Save Changes' ); ?>"/>
311 </p>
312 </form>
313 </div>
314 </div>
315 <?php
316 // If GDPR isn't enabled show ad otherwise show demo ad.
317 if ( true === empty( $gdpr_config ) ) {
318 include $plugin_dir . 'templates/sidebar/gdpr-ad.php';
319 } else {
320 // If Demo is not enabled show ad.
321 if ( true === empty( get_option( 'googleanalytics_demographic' ) ) ) {
322 include $plugin_dir . 'templates/sidebar/demo-ad.php';
323 }
324 }
325 ?>
326 <?php if ( false === empty( $data['debug_info'] ) ) : ?>
327 <tr>
328 <td colspan="2">
329 <p>If you are still experiencing an issue, we are here to help! We recommend clickingthe "Send
330 Debugging Info" button below and pasting the information within an email to
331 support@sharethis.com.</p>
332 <p>
333 <button id="ga_debug_button" class="button button-secondary"
334 onclick="ga_debug.open_modal( event )">Send Debugging Info
335 </button>
336 <?php if ( false === empty( $data['ga_accounts_selector'] ) ) : ?>
337 <?php echo wp_kses_post( $data['auth_button'] ); ?>
338 <br>
339 <small class="notice">
340 *If you reset your google password you MUST re-authenticate to continue viewing your
341 analytics dashboard.
342 </small>
343 <?php endif; ?>
344 </p>
345 </td>
346 </tr>
347 <?php endif; ?>
348
349 <p class="ga-love-text"><?php esc_html_e( 'Love this plugin?' ); ?> <a
350 href="https://wordpress.org/support/plugin/googleanalytics/reviews/#new-post"><?php esc_html_e( ' Please help spread the word by leaving a 5-star review!' ); ?> </a>
351 </p>
352 </div>
353 <script type="text/javascript">
354 const GA_DISABLE_FEATURE_URL = '<?php echo esc_url( Ga_Helper::create_url( admin_url( Ga_Helper::GA_SETTINGS_PAGE_URL ), array( Ga_Controller_Core::ACTION_PARAM_NAME => 'ga_action_disable_all_features' ) ) ); ?>';
355 const GA_ENABLE_FEATURE_URL = '<?php echo esc_url( Ga_Helper::create_url( admin_url( Ga_Helper::GA_SETTINGS_PAGE_URL ), array( Ga_Controller_Core::ACTION_PARAM_NAME => 'ga_action_enable_all_features' ) ) ); ?>';
356 jQuery( document ).ready( function() {
357 ga_switcher.init( '<?php echo esc_js( $data[ Ga_Admin::GA_DISABLE_ALL_FEATURES ] ); ?>' );
358 } );
359 </script>
360 <?php
361 require 'templates/demo-popup.php';
362