Google Analytics - Version 2.5.0

Version Description

  • Fix enable button on disable all features.
  • Add demographic ad in settings.
  • Add jump link to demographics in dashboard.
  • Add error message for no-demo data.
Download this release

Release Info

Developer ShareThis
Plugin Icon wp plugin Google Analytics
Version 2.5.0
Comparing to
See all releases

Code changes from version 2.4.1 to 2.5.0

assets/images/demo-ex.png ADDED
Binary file
class/Ga_Admin.php CHANGED
@@ -519,15 +519,13 @@ class Ga_Admin {
519
  }
520
 
521
  if ( Ga_Helper::get_option( self::GA_DISABLE_ALL_FEATURES ) ) {
522
- echo wp_kses_post(
523
- Ga_Helper::ga_wp_notice(
524
- __( 'You have disabled all extra features, click here to enable Dashboards, Viral Alerts and Google API.' ),
525
- 'warning',
526
- false,
527
- array(
528
- 'url' => admin_url( Ga_Helper::create_url( Ga_Helper::GA_SETTINGS_PAGE_URL, array( Ga_Controller_Core::ACTION_PARAM_NAME => 'ga_action_enable_all_features' ) ) ),
529
- 'label' => __( 'Enable' ),
530
- )
531
  )
532
  );
533
  }
@@ -546,7 +544,7 @@ class Ga_Admin {
546
  * @return string
547
  */
548
  public static function admin_notice_googleanalytics_wp_version() {
549
- echo wp_kses_post( Ga_Helper::ga_wp_notice( 'Google Analytics plugin requires at least WordPress version ' . self::MIN_WP_VERSION, 'error' ) );
550
  }
551
 
552
  /**
@@ -831,6 +829,7 @@ class Ga_Admin {
831
 
832
  private static function updateDemoData($gender_response = false, $age_response = false)
833
  {
 
834
  $demoSendData = [];
835
  if ($gender_response && $age_response) {
836
  foreach ($age_response as $type => $amount) {
@@ -860,6 +859,7 @@ class Ga_Admin {
860
  $demo_enabled = get_option('googleanalytics_demographic');
861
  $demo_date = get_option('googleanalytics_demo_date');
862
  $demo_date = !empty($demo_date) ? strtotime($demo_date) : '';
 
863
  $thirty_date = '' !== $demo_date ? date("Y-m-d", strtotime("+1 month", $demo_date)) : '';
864
 
865
  if (empty($demo_enabled) || !$demo_enabled) {
519
  }
520
 
521
  if ( Ga_Helper::get_option( self::GA_DISABLE_ALL_FEATURES ) ) {
522
+ echo Ga_Helper::ga_wp_notice(
523
+ __( 'You have disabled all extra features, click here to enable Dashboards, Viral Alerts and Google API.' ),
524
+ 'warning',
525
+ false,
526
+ array(
527
+ 'url' => admin_url( Ga_Helper::create_url( Ga_Helper::GA_SETTINGS_PAGE_URL, array( Ga_Controller_Core::ACTION_PARAM_NAME => 'ga_action_enable_all_features' ) ) ),
528
+ 'label' => __( 'Enable' ),
 
 
529
  )
530
  );
531
  }
544
  * @return string
545
  */
546
  public static function admin_notice_googleanalytics_wp_version() {
547
+ echo Ga_Helper::ga_wp_notice( 'Google Analytics plugin requires at least WordPress version ' . self::MIN_WP_VERSION, 'error' );
548
  }
549
 
550
  /**
829
 
830
  private static function updateDemoData($gender_response = false, $age_response = false)
831
  {
832
+ $x = 0;
833
  $demoSendData = [];
834
  if ($gender_response && $age_response) {
835
  foreach ($age_response as $type => $amount) {
859
  $demo_enabled = get_option('googleanalytics_demographic');
860
  $demo_date = get_option('googleanalytics_demo_date');
861
  $demo_date = !empty($demo_date) ? strtotime($demo_date) : '';
862
+ $current_date = date("Y-m-d");
863
  $thirty_date = '' !== $demo_date ? date("Y-m-d", strtotime("+1 month", $demo_date)) : '';
864
 
865
  if (empty($demo_enabled) || !$demo_enabled) {
css/googleanalytics.css CHANGED
@@ -46,7 +46,7 @@
46
 
47
  .ga_container .filter-choices a {
48
  background: #f9f9f9;
49
- width: 100px;
50
  display: inline-block;
51
  padding: 10px 20px;
52
  border-radius: 5px;
46
 
47
  .ga_container .filter-choices a {
48
  background: #f9f9f9;
49
+ width: 105px;
50
  display: inline-block;
51
  padding: 10px 20px;
52
  border-radius: 5px;
googleanalytics.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Google Analytics
5
  * Plugin URI: http://wordpress.org/extend/plugins/googleanalytics/
6
  * Description: Use Google Analytics on your WordPress site without touching any code, and view visitor reports right in your WordPress admin dashboard!
7
- * Version: 2.4.1
8
  * Author: ShareThis
9
  * Author URI: http://sharethis.com
10
  */
@@ -47,7 +47,7 @@ if ( !preg_match( '/(\/|\\\)' . GA_NAME . '(\/|\\\)/', realpath( __FILE__ ), $te
47
  die();
48
  }
49
 
50
- define( 'GOOGLEANALYTICS_VERSION', '2.4.0' );
51
  include_once GA_PLUGIN_DIR . '/overwrite/ga_overwrite.php';
52
  include_once GA_PLUGIN_DIR . '/class/Ga_Autoloader.php';
53
  include_once GA_PLUGIN_DIR . '/tools/class-support-logging.php';
4
  * Plugin Name: Google Analytics
5
  * Plugin URI: http://wordpress.org/extend/plugins/googleanalytics/
6
  * Description: Use Google Analytics on your WordPress site without touching any code, and view visitor reports right in your WordPress admin dashboard!
7
+ * Version: 2.5.0
8
  * Author: ShareThis
9
  * Author URI: http://sharethis.com
10
  */
47
  die();
48
  }
49
 
50
+ define( 'GOOGLEANALYTICS_VERSION', '2.5.0' );
51
  include_once GA_PLUGIN_DIR . '/overwrite/ga_overwrite.php';
52
  include_once GA_PLUGIN_DIR . '/class/Ga_Autoloader.php';
53
  include_once GA_PLUGIN_DIR . '/tools/class-support-logging.php';
js/googleanalytics_page.js CHANGED
@@ -464,7 +464,7 @@ const GA_AUTHENTICATION_CODE_ERROR = 'That looks like your Google Analytics Trac
464
  url: ajaxurl,
465
  data: dataObj,
466
  success: function (response) {
467
- window.location.reload();
468
  }
469
  });
470
  }
@@ -506,9 +506,19 @@ const GA_AUTHENTICATION_CODE_ERROR = 'That looks like your Google Analytics Trac
506
  };
507
 
508
  $(document).ready(function () {
509
- ga_events.initModalEvents();
510
- ga_events.enableGdpr();
511
- ga_events.setGDPRConfig($('body').hasClass('google-analytics_page_googleanalytics-gdpr'));
 
 
 
 
 
 
 
 
 
 
512
  });
513
 
514
  const offset = 50;
@@ -583,29 +593,26 @@ const GA_AUTHENTICATION_CODE_ERROR = 'That looks like your Google Analytics Trac
583
  chart.draw(data, options);
584
  },
585
  drawDemoGenderChart: function (data, chartWidth) {
586
-
587
  if (typeof chartWidth == 'undefined') {
588
  chartWidth = ga_tools.recomputeChartWidth(minWidth, offset, wrapperSelector);
589
  }
590
 
591
- var data = google.visualization.arrayToDataTable(data);
592
 
 
593
  var options = {
594
  title: 'Gender'
595
  };
596
 
597
- var chart = new google.visualization.PieChart(document.getElementById(demoChartGenderContainer));
598
-
599
  chart.draw(data, options);
600
  },
601
 
602
  drawDemoAgeChart: function (data, chartWidth) {
603
-
604
  if (typeof chartWidth == 'undefined') {
605
  chartWidth = ga_tools.recomputeChartWidth(minWidth, offset, wrapperSelector);
606
  }
607
 
608
- var data = google.visualization.arrayToDataTable(data);
609
 
610
  var options = {
611
  title: 'Age',
464
  url: ajaxurl,
465
  data: dataObj,
466
  success: function (response) {
467
+ window.location.href = siteAdminUrl + 'admin.php?page=googleanalytics&ga_action=demo-ad';
468
  }
469
  });
470
  }
506
  };
507
 
508
  $(document).ready(function () {
509
+ const scrollData = $( '#ga-stats-container' ).attr( 'data-scroll' );
510
+ const scrollEl = '' !== scrollData ? $('.' + scrollData) : '';
511
+ const theBody = $('body');
512
+
513
+ ga_events.initModalEvents();
514
+ ga_events.enableGdpr();
515
+ ga_events.setGDPRConfig(theBody.hasClass('google-analytics_page_googleanalytics-gdpr'));
516
+
517
+ if ( '' !== scrollData && theBody.hasClass( 'toplevel_page_googleanalytics' ) ) {
518
+ $([document.documentElement, document.body]).animate({
519
+ scrollTop: scrollEl.offset().top + 450
520
+ }, 500);
521
+ }
522
  });
523
 
524
  const offset = 50;
593
  chart.draw(data, options);
594
  },
595
  drawDemoGenderChart: function (data, chartWidth) {
 
596
  if (typeof chartWidth == 'undefined') {
597
  chartWidth = ga_tools.recomputeChartWidth(minWidth, offset, wrapperSelector);
598
  }
599
 
600
+ data = google.visualization.arrayToDataTable(data);
601
 
602
+ var chart = new google.visualization.PieChart(document.getElementById(demoChartGenderContainer));
603
  var options = {
604
  title: 'Gender'
605
  };
606
 
 
 
607
  chart.draw(data, options);
608
  },
609
 
610
  drawDemoAgeChart: function (data, chartWidth) {
 
611
  if (typeof chartWidth == 'undefined') {
612
  chartWidth = ga_tools.recomputeChartWidth(minWidth, offset, wrapperSelector);
613
  }
614
 
615
+ data = google.visualization.arrayToDataTable(data);
616
 
617
  var options = {
618
  title: 'Age',
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: sharethis, scottstorebloom
3
  Tags: analytics, google analytics, google analytics plugin, google analytics widget, google analytics dashboard
4
  Requires at least: 3.8
5
- Tested up to: 5.5.1
6
- Stable tag: 2.4.1
7
 
8
  Use Google Analytics on your Wordpress site without touching any code, and view visitor reports right in your Wordpress admin dashboard!
9
 
@@ -49,6 +49,20 @@ If you have any questions, please contact us at [support@sharethis.com](mailto:s
49
  By downloading and installing this plugin, you are agreeing to the [Privacy Policy](http://www.sharethis.com/privacy/) and [Terms of Service](http://www.sharethis.com/publisher-terms-of-use/).
50
 
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  == Installation ==
53
 
54
  1. Install Google Analytics either via WordPress.org plugin repository or directly by uploading the files to your server
@@ -58,27 +72,38 @@ By downloading and installing this plugin, you are agreeing to the [Privacy Poli
58
  5. When any of your content takes off you will see the URLs inside the Trending Content section
59
 
60
  == Frequently Asked Questions ==
61
- = Is this plugin compatible with WPML? =
62
- Yes! We've made adjustments to allow for WPML pages to be tracked properly.
 
 
63
 
64
- = Why do I need an SSL certificate to use this plugin? =
65
- Since the plugin accesses your Google Analytics account your login information is transerfered from our plugin to google. This needs to be secure so SSL is required to keep your information safe.
66
 
67
- = Do I need to touch any code to add Google Analytics? =
68
- Nope, just sign in with google, choose your website, and our plugin will automatically add Google analytics code to all pages.
69
 
70
- = How do I make sure Google Analytics is properly installed on all pages? =
71
- If you signed it with google and selected your website (or manually added the property ID) the Google Analytics javascript will be added to all pages. To check what UA code it is adding, just open any page of your website in Chrome, right click to select Inspect, navigate to Network tab, reload the page and search for googleanalytics, you will see the google code with your UA ID. <a href=”https://cl.ly/1q3o2q26261V/[e5b08a5ae1c09684a56ba14c36e6fa5c]_Screen%2520Shot%25202017-02-06%2520at%25201.57.34%2520PM.png” title=”Google Analytics code on the page example”>See example here.</a>
72
 
73
- = I see broken formatting inside the plugin, for example some buttons are not aligned? =
74
- This is likely caused by AdBlocker that is blocking anything related to "google analytics". Please disable AdBlocker for your own website or add it to exceptions if you are using Opera.
 
 
75
 
76
- = How does that cool "Trending Content" feature work? =
77
- It learns about your traffic patterns to spot "spikes" of visitors and then sends an alert. If your website doesn't have good amount of visitors you might not see any Trending Content Alerts because the algorithm needs more data to see "trends".
78
 
79
- = I have other questions, where I can get support or provide feedback? =
80
- If you have any questions please let us know directly at support@sharethis.com or create a new ticket within our WP support portal.
81
- We are always happy to help.
 
 
 
 
 
 
 
 
82
 
83
  == Screenshots ==
84
 
@@ -89,6 +114,12 @@ We are always happy to help.
89
 
90
  == Changelog ==
91
 
 
 
 
 
 
 
92
  = 2.4.1 =
93
  * Fix admin error.
94
 
2
  Contributors: sharethis, scottstorebloom
3
  Tags: analytics, google analytics, google analytics plugin, google analytics widget, google analytics dashboard
4
  Requires at least: 3.8
5
+ Tested up to: 5.7
6
+ Stable tag: 2.5.0
7
 
8
  Use Google Analytics on your Wordpress site without touching any code, and view visitor reports right in your Wordpress admin dashboard!
9
 
49
  By downloading and installing this plugin, you are agreeing to the [Privacy Policy](http://www.sharethis.com/privacy/) and [Terms of Service](http://www.sharethis.com/publisher-terms-of-use/).
50
 
51
 
52
+ **USEFUL GOOGLE ANALYTICS & SEO RESOURCES**
53
+
54
+ Check out these helpful tutorials and resources for getting the most out of Google Analytics, driving more traffic to your website, and improving your WordPress website’s SEO:
55
+
56
+ * [Marketer’s Guide to Google Analytics Certification](https://sharethis.com/thought-leadership/2020/02/marketers-guide-to-google-analytics-certification/)
57
+ * [The Ultimate SEO Checklist for Your Website in 2020](https://sharethis.com/best-practices/2020/07/ultimate-seo-checklist/)
58
+ * [WordPress SEO Tips: 12 Tips for Improving Your WordPress Site’s SEO](https://sharethis.com/best-practices/2020/07/wordpress-seo-tips/)
59
+ * [50 SEO Tips & Best Practices to Boost Search Visibility](https://sharethis.com/best-practices/2020/03/seo-tips-and-best-practices/)
60
+ * [6 tips to write blog content that ranks](https://sharethis.com/thought-leadership/2019/01/6-tips-to-write-blog-content-that-ranks/)
61
+ * [10 ways to increase traffic to your website](https://sharethis.com/best-practices/2019/08/10-ways-to-increase-traffic-to-your-website/)
62
+ * [What are Backlinks? A Helpful Guide for Link-Building Beginners](https://sharethis.com/best-practices/2020/04/what-are-backlinks/)
63
+ * [How negative SEO ruin good sites — and how to keep your site lookin’ great](https://sharethis.com/best-practices/2016/11/how-negative-seo-ruin-good-sites/)
64
+ * [How to strategically use share buttons to increase engagement and SEO](https://sharethis.com/best-practices/2017/08/how-to-strategically-use-share-buttons-to-boost-engagement-and-seo/)
65
+
66
  == Installation ==
67
 
68
  1. Install Google Analytics either via WordPress.org plugin repository or directly by uploading the files to your server
72
  5. When any of your content takes off you will see the URLs inside the Trending Content section
73
 
74
  == Frequently Asked Questions ==
75
+ = Why Do I Need Google Analytics for My WordPress Website? =
76
+ Google Analytics is a powerful tool for monitoring website performance. With Google Analytics, you’ll gain insights such as what geographic areas your visitors are coming from, what channels led them to your website (paid search, social, organic, etc.), what devices they use to browse your site, and what other websites are sending visitors to your site.
77
+ But Google Analytics does much more than simply show you how visitors are finding your website. Once visitors land on your site, Google Analytics can show you what pages they visit, how much time they spend on each page, what links they click, what files they download, what pages are converting visitors to subscribers or buyers, and much more.
78
+ Armed with this data, you can create valuable content perfectly targeted to your visitors’ needs. When you know what topics your visitors search for and spend the most time on when they reach your website, you can create content expanding on or covering related topics to keep them coming back for more.
79
 
80
+ = How Do I Use Google Analytics on WordPress? =
81
+ Using Google Analytics on your WordPress website is a must for monitoring your website’s traffic and gaining valuable visitor insights. There are two ways to use Google Analytics on WordPress:
82
 
83
+ * Manually adding the Google Analytics tracking code to your header.php file
84
+ * Installing the Google Analytics Dashboard for WordPress plugin and setting up tracking in a few simple steps
85
 
86
+ While some publishers prefer the manual option, installing the Google Analytics Dashboard for WordPress plugin not only makes it easier to configure Google Analytics for your WordPress website by authenticating via Google, but it also provides you with a number of additional convenient features. With the Google Analytics Dashboard for WordPress plugin, you’ll get access to your most important Google Analytics data right within your WordPress dashboard. And that means you can say goodbye to frustrating website analysis that requires constant switching between multiple browser tabs.
 
87
 
88
+ = Do I Need to Put Google Analytics Tracking Code on Every Page? =
89
+ Google Analytics tracking code is a block of JavaScript code that executes Google Analytics tracking when a visitor loads a page on your website. The script that triggers these events must be loaded on every page in order for Google Analytics tracking to work.
90
+ That doesn’t mean you need to become an expert in JavaScript code or spend hours manually inserting Google Analytics tracking code on every page of your WordPress website. You can insert the tracking code in your header.php file so that it automatically loads on every page, or you can install the Google Analytics Dashboard for WordPress plugin and follow a few simple steps to get Google Analytics tracking setup in minutes by authenticating with Google.
91
+ Even if you prefer the traditional manual option of adding the UA tracking code to every page, the Google Analytics Dashboard for WordPress plugin makes that process easier, too. Simply click “Manually enter Tracking ID” and paste your Google Tracking code into the box that appears. Then, just click “Save Changes,” and your code will instantly be live on all your pages. Click here for more details on this process. However, keep in mind that using this option means your dashboards won’t appear, so to get the most from the Google Analytics Dashboard for WordPress plugin, we recommend using the authenticate with Google setup option from our latest update.
92
 
93
+ = How Do I Use Google Analytics for SEO? =
94
+ There are many ways to leverage Google Analytics to improve your WordPress website’s SEO. SEO, or search engine optimization, is the practice of tracking and analyzing website data to improve organic traffic. But tracking traffic and other website metrics alone doesnt magically improve your SEO. Here are a few ways to leverage all the valuable Google Analytics data to improve your WordPress website’s SEO, start improving your search engine rankings, and growing your website traffic organically:
95
 
96
+ * Set up goals and track conversions to monitor performance. If you’re trying to grow your email marketing list, for instance, you can create goals in Google Analytics to monitor how well your opt-in pages or forms are converting visitors. If you’re generating leads for your business, set up goals to track how well your landing pages are performing. If you’re not seeing the conversion rates you’re aiming for, you can revisit your copy or conduct A/B tests to implement targeted improvements.
97
+ * Install the Google Analytics for WordPress plugin to get the most important insights in your WordPress dashboard. With the Google Analytics Dashboard for WordPress plugin, you can monitor important metrics like page views, pages per session, and bounce rate for the past 7 days compared to the previous 7 days. The plugin keeps you up to date on your 10 top-performing web pages or posts based on page views and the top 5 traffic sources that are driving the most visitors to your website, plus it gives you access to age and gender data – all without navigating away from your WordPress dashboard. When you authenticate your Google Analytics account when setting up the plugin, you can exclude all irrelevant traffic (such as administrators and editors) so you get the most accurate insights.
98
+ * Update and promote your top-performing content. With the Google Analytics Dashboard for WordPress plugin, you’ll always be aware of your 10 top-performing pages. While seeing your carefully crafted content getting the attention it deserves is worthy of celebration, don’t pop the cork on that sparkling water or champagne just yet. Leverage that data to promote your best-performing content with social media ads or organic social media posts, or slate those posts for an update to make them even better and draw in even more visitors who stick around to visit more pages on your site. Another way to leverage your top-performing pages data is to create content on topics related to your top-performing posts or content, which can boost repeat visits from the same visitors who helped catapult the original page to top-performer status.
99
+ * Take steps to reduce bounce rate. The Google Analytics Dashboard for WordPress keeps you up-to-date on your website’s bounce rate over a 7-day period compared to the previous 7-day period. If your bounce rate is rising, it’s likely that you have an SEO problem. For instance, if visitors are reaching your site from relevant keywords but aren’t sticking around, you might consider targeting different or longer-tail keywords to better match users’ search intent. Perhaps your content is thin on landing pages and other points of entry, and visitors quickly bounce, thinking that your website isn’t offering the level of information they’re looking for. You can address this issue by creating more effective landing pages and entry pages to capture visitors’ attention in the first few seconds.
100
+ * Try different tactics to improve page views and pages per session. If your bounce rate is creeping up, it’s likely that your page views and pages per session are declining. This issue can be addressed by creating longer-form, data-driven, and highly detailed content to draw visitors in and keep them sticking around. Consider creating pillar content with topic clusters that encourage visitors to explore the deeper levels of your website through strategic linking and use videos and other visuals on your web pages to engage visitors.
101
+ * Keep tabs on top referral sources – and nurture them. The Google Analytics Dashboard for WordPress shows you your website’s top 5 traffic sources that are driving the most visitors to your website. This may seem like it’s just interesting-to-know information, but it’s actually a goldmine. Why? First, you can discover organically earned backlinks that you weren’t previously aware of, and then leverage that information to get more of them. For instance, if an influencer linked to your content, you can reach out to arrange having them guest blog on your website (or vice-versa) to bring in even more traffic or expand your reach to a wider, relevant audience. You can also conduct some research to find other similar influencers or publishers and conduct an outreach campaign to encourage them to link to the same post, arrange guest posting opportunities, or pursue other mutually beneficial partnerships.
102
+
103
+ = How Do I Stay Compliant with GDPR When Using Google Analytics? =
104
+ When the General Data Protection Regulation (GDPR) was first introduced, website publishers everywhere were fraught with anxiety about what it would mean for their businesses and overwhelmed with the steps they needed to take to ensure compliance. If you’re running third-party tools on your website, such as share buttons and follow buttons or Google Analytics, these tools are likely collecting information about your website visitors – and that means you’re on the hook for GDPR compliance, especially if you get visitors from the EU.
105
+ Fortunately, a number of useful compliance tools emerged to make compliance easier for publishers and businesses of all sizes. Consent Management Platforms (CMPs) are tools designed to inform visitors about the data a website or third-party tool is collecting about them and how that data will be used, provide an opt-in option for users to grant consent to have their data collected (as well as an opt-out option to decline), and communicate the consent status of users and cookies to other vendors operating within the IAB Framework. CMPs also offer transparency to users, providing granular information on the companies their data will be shared with and allowing them to monitor and control who receives their data. Finally, CMPs provide a centralized database for users to review the most up-to-date privacy policies and information related to their data collection.
106
+ If you’re using Google Analytics on your WordPress website or a plugin like the Google Analytics Dashboard for WordPress, you must comply with GDPR. A CMP is the best way to manage the consent process for GDPR compliance. With ShareThis’ GDPR Compliance Tool built right in to the Google Analytics Dashboard for WordPress plugin, you can easily stay on top of getting consent to collect your visitors’ data and provide visitors with clear and valuable information. Our GDPR Compliance Tool is compliant with the IAB’s Transparency & Consent Framework v2.0, meaning it meets the latest standards for transparency in data collection and consent management. Check out our GDPR checklist for publishers & website owners to make sure you’re meeting the requirements or download our GDPR Compliance Guide for detailed information on GDPR compliance with ShareThis’ tools.
107
 
108
  == Screenshots ==
109
 
114
 
115
  == Changelog ==
116
 
117
+ = 2.5.0 =
118
+ * Fix enable button on disable all features.
119
+ * Add demographic ad in settings.
120
+ * Add jump link to demographics in dashboard.
121
+ * Add error message for no-demo data.
122
+
123
  = 2.4.1 =
124
  * Fix admin error.
125
 
view/page.php CHANGED
@@ -3,6 +3,8 @@ $optimize_code = get_option( 'googleanalytics_optimize_code' );
3
  $universal = get_option( 'googleanalytics_enable_universal_analytics', true );
4
  $anonymization = get_option( 'googleanalytics_ip_anonymization', true );
5
  $gdpr_config = get_option( 'googleanalytics_gdpr_config');
 
 
6
  ?>
7
  <div id="adblocker-notice" class="notice notice-error is-dismissible">
8
  <p>
@@ -214,7 +216,7 @@ $gdpr_config = get_option( 'googleanalytics_gdpr_config');
214
  </label>
215
  </td>
216
  </tr>
217
- <?php include plugin_dir_path(__FILE__) . 'templates/gdpr.php'; ?>
218
  </table>
219
 
220
  <p class="submit">
@@ -222,70 +224,17 @@ $gdpr_config = get_option( 'googleanalytics_gdpr_config');
222
  value="<?php _e( 'Save Changes' ) ?>"/>
223
  </p>
224
  </form>
225
- <?php if(empty($gdpr_config)) : ?>
226
- <div class="sidebar-ad">
227
- <h2 style="text-decoration: underline;">
228
- <?php esc_html_e('Check out our new GDPR Compliance Tool!', 'googleanalytics'); ?>
229
- </h2>
230
- <div class="row">
231
- <div class="col-md-12">
232
- <img src="<?php echo trailingslashit(get_home_url()) . 'wp-content/plugins/googleanalytics/assets/images/gdpr-ex.png'; ?>" />
233
- </div>
234
- <div class="col-md-6">
235
- <h3><?php esc_html_e('Confirm Consent', 'googleanalytics'); ?></h3>
236
- <p>
237
- <?php esc_html_e(
238
- 'A simple and streamlined way to confirm a user’s initial acceptance or rejection of cookie collection',
239
- 'googleanalytics'
240
- ); ?>
241
- </p>
242
- </div>
243
- <div class="col-md-6">
244
- <h3><?php esc_html_e('Select Purpose', 'googleanalytics'); ?></h3>
245
- <p>
246
- <?php esc_html_e(
247
- 'A transparent system of verifying the intent of collecting a user’s cookies, and giving the option to opt in or out',
248
- 'googleanalytics'
249
- ); ?>
250
- </p>
251
- </div>
252
- </div>
253
- <div class="row">
254
- <div class="col-md-6">
255
- <h3><?php esc_html_e('Indicate Company', 'googleanalytics'); ?></h3>
256
- <p>
257
- <?php esc_html_e(
258
- 'A comprehensive record of company-level information that allows users to monitor and control the recipients of cookie collection',
259
- 'googleanalytics'
260
- ); ?>
261
- </p>
262
- </div>
263
- <div class="col-md-6">
264
- <h3><?php esc_html_e('Access Data Rights', 'googleanalytics'); ?></h3>
265
- <p>
266
- <?php esc_html_e(
267
- 'A centralized database where users can review the latest privacy policies and information pertaining to their cookie collection',
268
- 'googleanalytics'
269
- ); ?>
270
- </p>
271
- </div>
272
- </div>
273
- <div class="row register-section">
274
- <?php if ( Ga_Helper::are_features_enabled() ) : ?>
275
- <td>
276
- <button class="gdpr-enable"><?php esc_html_e('Enable'); ?></button>
277
- </td>
278
- <?php else : ?>
279
- <td>
280
- <label class="<?php echo ( ! Ga_Helper::are_features_enabled() ) ? 'label-grey ga-tooltip' : '' ?>">
281
- <button class="gdpr-enable" disabled="disabled"><?php esc_html_e('Enable'); ?></button>
282
- <span class="ga-tooltiptext ga-tt-abs"><?php _e( $tooltip ); ?></span>
283
- </label>
284
- </td>
285
- <?php endif; ?>
286
- </div>
287
- </div>
288
- <?php endif; ?>
289
  </div>
290
  <?php if ( $data['debug_info'] ) : ?>
291
  <tr valign="top">
@@ -316,3 +265,4 @@ $gdpr_config = get_option( 'googleanalytics_gdpr_config');
316
  ga_switcher.init('<?php echo $data[ Ga_Admin::GA_DISABLE_ALL_FEATURES ]; ?>');
317
  });
318
  </script>
 
3
  $universal = get_option( 'googleanalytics_enable_universal_analytics', true );
4
  $anonymization = get_option( 'googleanalytics_ip_anonymization', true );
5
  $gdpr_config = get_option( 'googleanalytics_gdpr_config');
6
+ $plugin_dir = plugin_dir_path(__FILE__);
7
+ $plugin_uri = trailingslashit(get_home_url()) . 'wp-content/plugins/googleanalytics/';
8
  ?>
9
  <div id="adblocker-notice" class="notice notice-error is-dismissible">
10
  <p>
216
  </label>
217
  </td>
218
  </tr>
219
+ <?php include $plugin_dir . 'templates/gdpr.php'; ?>
220
  </table>
221
 
222
  <p class="submit">
224
  value="<?php _e( 'Save Changes' ) ?>"/>
225
  </p>
226
  </form>
227
+ <?php
228
+ // If GDPR isn't enabled show ad otherwise show demo ad.
229
+ if (empty($gdpr_config)) {
230
+ include $plugin_dir . 'templates/sidebar/gdpr-ad.php';
231
+ } else {
232
+ // If Demo is not enabled show ad.
233
+ if (! get_option('googleanalytics_demographic')) {
234
+ include $plugin_dir . 'templates/sidebar/demo-ad.php';
235
+ }
236
+ }
237
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  </div>
239
  <?php if ( $data['debug_info'] ) : ?>
240
  <tr valign="top">
265
  ga_switcher.init('<?php echo $data[ Ga_Admin::GA_DISABLE_ALL_FEATURES ]; ?>');
266
  });
267
  </script>
268
+ <?php include 'templates/demo-popup.php';
view/stats.php CHANGED
@@ -28,8 +28,20 @@ $seven_url = isset($_GET['ts']) ? 'admin.php?page=googleanalytics&ts' : 'admin.p
28
  $source_url = isset($_GET['th']) ? 'admin.php?page=googleanalytics&ts&th' : 'admin.php?page=googleanalytics&ts';
29
  $page_view_url = isset($_GET['th']) ? 'admin.php?page=googleanalytics&th' : 'admin.php?page=googleanalytics';
30
  $send_data = get_option('googleanalytics_send_data');
 
31
  ?>
32
- <div class="wrap ga-wrap" id="ga-stats-container">
 
 
 
 
 
 
 
 
 
 
 
33
  <?php if ( ! empty( $chart ) ) : ?>
34
  <div class="filter-choices">
35
  <a href="<?php echo get_admin_url('', $seven_url ); ?>" class="<?php echo esc_attr( $selected7 ); ?>">
@@ -221,22 +233,8 @@ $send_data = get_option('googleanalytics_send_data');
221
  }
222
  );
223
  </script>
224
- <?php endif; ?>
225
- <div class="demo-enable-popup">
226
- <p>
227
- We are deploying additional data from your Google Analytics account to your WordPress dashboard
228
- as a free service to assist you in operating your WordPress site.
229
- This will result in Google Analytics having access to data collected from Your site(s)
230
- and subject to Google’s privacy policies as described in the <a
231
- href="http://www.sharethis.com/publisher-terms-of-use/" target="_blank">ShareThis Publisher TOU</a>.
232
- We will also use the aggregate demographic data related to your site for analytic purposes.
233
- We will not sell or transfer any of the demographic data relating to your site to any other party.
234
- For more information, please visit the <a
235
- href="http://www.sharethis.com/news/2016/12/sharethis-adds-analytics-plugin-to-suite-of-tools/"
236
- target="_blank">ShareThis Privacy Policy</a> and <a
237
- href="http://www.sharethis.com/publisher-terms-of-use/" target="_blank">Publisher TOU</a>.
238
- </p>
239
- <button id="enable-demographic">I accept</button>
240
- <button class="close-demo-modal">Decline</button>
241
- </div>
242
  </div>
28
  $source_url = isset($_GET['th']) ? 'admin.php?page=googleanalytics&ts&th' : 'admin.php?page=googleanalytics&ts';
29
  $page_view_url = isset($_GET['th']) ? 'admin.php?page=googleanalytics&th' : 'admin.php?page=googleanalytics';
30
  $send_data = get_option('googleanalytics_send_data');
31
+ $need_account_demo_enable = [] === $gender_chart && [] === $age_chart;
32
  ?>
33
+ <?php if (!$demo_enabled) {
34
+ echo Ga_Helper::ga_wp_notice(
35
+ __( 'Visualize gender and age data with our new demographic feature.' ),
36
+ 'warning',
37
+ false,
38
+ [
39
+ 'url' => Ga_Helper::create_url( Ga_Helper::get_current_url(), array( Ga_Controller_Core::ACTION_PARAM_NAME => 'demo-ad' ) ),
40
+ 'label' => __( 'Access Now' ),
41
+ ]
42
+ );
43
+ } ?>
44
+ <div class="wrap ga-wrap" id="ga-stats-container" data-scroll="<?php echo !empty($_GET['ga_action']) ? $_GET['ga_action'] : ''; ?>">
45
  <?php if ( ! empty( $chart ) ) : ?>
46
  <div class="filter-choices">
47
  <a href="<?php echo get_admin_url('', $seven_url ); ?>" class="<?php echo esc_attr( $selected7 ); ?>">
233
  }
234
  );
235
  </script>
236
+ <?php endif;
237
+ include 'templates/demo-popup.php';
238
+ ?>
239
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  </div>
view/templates/demo-popup.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="demo-enable-popup">
2
+ <p>
3
+ We are deploying additional data from your Google Analytics account to your WordPress dashboard
4
+ as a free service to assist you in operating your WordPress site.
5
+ This will result in Google Analytics having access to data collected from Your site(s)
6
+ and subject to Google’s privacy policies as described in the <a
7
+ href="http://www.sharethis.com/publisher-terms-of-use/" target="_blank">ShareThis Publisher TOU</a>.
8
+ We will also use the aggregate demographic data related to your site for analytic purposes.
9
+ We will not sell or transfer any of the demographic data relating to your site to any other party.
10
+ For more information, please visit the <a
11
+ href="http://www.sharethis.com/news/2016/12/sharethis-adds-analytics-plugin-to-suite-of-tools/"
12
+ target="_blank">ShareThis Privacy Policy</a> and <a
13
+ href="http://www.sharethis.com/publisher-terms-of-use/" target="_blank">Publisher TOU</a>.
14
+ </p>
15
+ <button id="enable-demographic">I accept</button>
16
+ <button class="close-demo-modal">Decline</button>
17
+ </div>
view/templates/demographic-chart.php CHANGED
@@ -3,11 +3,26 @@
3
  <div class="ga-panel-heading">
4
  <strong>
5
  <?php esc_html_e('Get Demographic Data!'); ?>
6
- <button id="demographic-popup">Click Here To Enable</button>
 
 
7
  </strong>
8
  </div>
9
  <img src="<?php echo trailingslashit(get_home_url()) . 'wp-content/plugins/googleanalytics/assets/images/demo-ad.png'; ?>" />
10
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  <?php else: ?>
12
  <div class="filter-choices">
13
  <a href="<?php echo get_admin_url('', $seven_url ); ?>" class="<?php echo esc_attr( $selected7 ); ?>">
3
  <div class="ga-panel-heading">
4
  <strong>
5
  <?php esc_html_e('Get Demographic Data!'); ?>
6
+ <button id="demographic-popup">
7
+ <?php esc_html_e('Click Here To Enable', 'googleanalytics'); ?>
8
+ </button>
9
  </strong>
10
  </div>
11
  <img src="<?php echo trailingslashit(get_home_url()) . 'wp-content/plugins/googleanalytics/assets/images/demo-ad.png'; ?>" />
12
  </div>
13
+ <?php elseif ($need_account_demo_enable) : ?>
14
+ <div class="demo-ad ga-panel ga-panel-default">
15
+ <div class="ga-panel-heading">
16
+ <strong>
17
+ <?php esc_html_e('If no demographics data is shown, you\'ll most likely need to enable "Demographics" within Google Analytics or there\'s insufficient Demographic data to display.
18
+ We recommend viewing your Google Analytics account to determine best solution:'); ?>
19
+ <br>
20
+ <a href="<?php echo esc_url( $demographic_page_url ); ?>/" class="view-report" target="_blank">
21
+ <?php echo esc_html__('Go to my account' ); ?>
22
+ </a>
23
+ </strong>
24
+ </div>
25
+ </div>
26
  <?php else: ?>
27
  <div class="filter-choices">
28
  <a href="<?php echo get_admin_url('', $seven_url ); ?>" class="<?php echo esc_attr( $selected7 ); ?>">
view/templates/sidebar/demo-ad.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template for GDPR side bar ad in settings page.
4
+ */
5
+ ?>
6
+ <div class="sidebar-ad">
7
+ <div id="demo-ad">
8
+ <h2 style="text-decoration: underline;">
9
+ <?php esc_html_e('Demographics data now available!', 'googleanalytics'); ?>
10
+ </h2>
11
+ <div class="row">
12
+ <div class="col-md-12">
13
+ <img src="<?php echo $plugin_uri . 'assets/images/demo-ex.png'; ?>" />
14
+ </div>
15
+ <div class="col-md-6">
16
+ <p>
17
+ <?php esc_html_e('Find out more about your target audience by enabling the demographics feature!', 'googleanalytics'); ?>
18
+ </p>
19
+ <h3><?php esc_html_e('Why Collect Demographics and Interests Data?', 'googleanalytics'); ?></h3>
20
+ <p>
21
+ <?php esc_html_e(
22
+ 'By viewing demographics data, you will learn more details about your visitors so you can deliver content/create products that address their needs!',
23
+ 'googleanalytics'
24
+ ); ?>
25
+ </p>
26
+ </div>
27
+ <div class="col-md-6">
28
+ <h3><?php esc_html_e('Gender', 'googleanalytics'); ?></h3>
29
+ <p>
30
+ <?php esc_html_e(
31
+ 'Understanding exactly which gender visits different areas of your website, could allow you to optimise those areas accordingly.',
32
+ 'googleanalytics'
33
+ ); ?>
34
+ </p>
35
+ </div>
36
+ </div>
37
+ <div class="row">
38
+ <div class="col-md-6">
39
+ <h3><?php esc_html_e('Age', 'googleanalytics'); ?></h3>
40
+ <p>
41
+ <?php esc_html_e(
42
+ 'Determine your site\'s age demographic and make the site more friendly to use for that group.',
43
+ 'googleanalytics'
44
+ ); ?>
45
+ </p>
46
+ </div>
47
+ </div>
48
+ <div class="row register-section">
49
+ <?php if ( Ga_Helper::are_features_enabled() ) : ?>
50
+ <td>
51
+ <button id="demographic-popup"><?php esc_html_e('Enable'); ?></button>
52
+ </td>
53
+ <?php else : ?>
54
+ <td>
55
+ <label class="<?php echo ( ! Ga_Helper::are_features_enabled() ) ? 'label-grey ga-tooltip' : '' ?>">
56
+ <button class="gdpr-enable" disabled="disabled"><?php esc_html_e('Enable'); ?></button>
57
+ <span class="ga-tooltiptext ga-tt-abs"><?php _e( $tooltip ); ?></span>
58
+ </label>
59
+ </td>
60
+ <?php endif; ?>
61
+ </div>
62
+ </div>
63
+ </div>
view/templates/sidebar/gdpr-ad.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template for GDPR side bar ad in settings page.
4
+ */
5
+ ?>
6
+ <div class="sidebar-ad">
7
+ <div id="gdpr-ad">
8
+ <h2 style="text-decoration: underline;">
9
+ <?php esc_html_e('Check out our new GDPR Compliance Tool!', 'googleanalytics'); ?>
10
+ </h2>
11
+ <div class="row">
12
+ <div class="col-md-12">
13
+ <img src="<?php echo $plugin_uri . 'assets/images/gdpr-ex.png'; ?>" />
14
+ </div>
15
+ <div class="col-md-6">
16
+ <h3><?php esc_html_e('Confirm Consent', 'googleanalytics'); ?></h3>
17
+ <p>
18
+ <?php esc_html_e(
19
+ 'A simple and streamlined way to confirm a user’s initial acceptance or rejection of cookie collection',
20
+ 'googleanalytics'
21
+ ); ?>
22
+ </p>
23
+ </div>
24
+ <div class="col-md-6">
25
+ <h3><?php esc_html_e('Select Purpose', 'googleanalytics'); ?></h3>
26
+ <p>
27
+ <?php esc_html_e(
28
+ 'A transparent system of verifying the intent of collecting a user’s cookies, and giving the option to opt in or out',
29
+ 'googleanalytics'
30
+ ); ?>
31
+ </p>
32
+ </div>
33
+ </div>
34
+ <div class="row">
35
+ <div class="col-md-6">
36
+ <h3><?php esc_html_e('Indicate Company', 'googleanalytics'); ?></h3>
37
+ <p>
38
+ <?php esc_html_e(
39
+ 'A comprehensive record of company-level information that allows users to monitor and control the recipients of cookie collection',
40
+ 'googleanalytics'
41
+ ); ?>
42
+ </p>
43
+ </div>
44
+ <div class="col-md-6">
45
+ <h3><?php esc_html_e('Access Data Rights', 'googleanalytics'); ?></h3>
46
+ <p>
47
+ <?php esc_html_e(
48
+ 'A centralized database where users can review the latest privacy policies and information pertaining to their cookie collection',
49
+ 'googleanalytics'
50
+ ); ?>
51
+ </p>
52
+ </div>
53
+ </div>
54
+ <div class="row register-section">
55
+ <?php if ( Ga_Helper::are_features_enabled() ) : ?>
56
+ <td>
57
+ <button class="gdpr-enable"><?php esc_html_e('Enable'); ?></button>
58
+ </td>
59
+ <?php else : ?>
60
+ <td>
61
+ <label class="<?php echo ( ! Ga_Helper::are_features_enabled() ) ? 'label-grey ga-tooltip' : '' ?>">
62
+ <button class="gdpr-enable" disabled="disabled"><?php esc_html_e('Enable'); ?></button>
63
+ <span class="ga-tooltiptext ga-tt-abs"><?php _e( $tooltip ); ?></span>
64
+ </label>
65
+ </td>
66
+ <?php endif; ?>
67
+ </div>
68
+ </div>
69
+ </div>