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