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