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