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