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