Version Description
- Fixed: Analytics back end menu position conflict
- Fixed: Bug on deleted property check
- Added: Error log
Download this release
Release Info
| Developer | webdorado |
| Plugin | |
| Version | 1.0.14 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.13 to 1.0.14
- admin/gawd_google_class.php +123 -17
- admin/tracking.php +1 -1
- gawd_class.php +19 -3
- google-analytics-wd.php +15 -2
- readme.txt +6 -1
admin/gawd_google_class.php
CHANGED
|
@@ -21,6 +21,10 @@ class GAWD_google_client {
|
|
| 21 |
$errors = $e->getErrors();
|
| 22 |
return $errors[0]["message"];
|
| 23 |
}catch(Exception $e){
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
return $e->getMessage();
|
| 25 |
}
|
| 26 |
}
|
|
@@ -103,6 +107,10 @@ class GAWD_google_client {
|
|
| 103 |
$errors = $e->getErrors();
|
| 104 |
return $errors[0]["message"];
|
| 105 |
} catch (Exception $e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
return $e->getMessage();
|
| 107 |
}
|
| 108 |
}
|
|
@@ -135,6 +143,10 @@ class GAWD_google_client {
|
|
| 135 |
}catch (Google_Service_Exception $e) {
|
| 136 |
//return $e->getErrors()[0]["message"];
|
| 137 |
} catch (Exception $e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
//return $e->getMessage();
|
| 139 |
}
|
| 140 |
return $accounts_light;
|
|
@@ -147,6 +159,10 @@ class GAWD_google_client {
|
|
| 147 |
return 'no_matches';
|
| 148 |
|
| 149 |
}catch(Exception $e){
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
return 'no_matches';
|
| 151 |
}
|
| 152 |
$exact_properties = array();
|
|
@@ -203,6 +219,10 @@ class GAWD_google_client {
|
|
| 203 |
return 'There was a general API error '
|
| 204 |
. $e->getCode() . ':' . $e->getMessage();
|
| 205 |
}catch (Exception $e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
echo $e->getCode() . ':' . $e->getMessage();
|
| 207 |
}
|
| 208 |
|
|
@@ -299,6 +319,10 @@ class GAWD_google_client {
|
|
| 299 |
}catch(Google_Service_Exception $e){
|
| 300 |
return $e;
|
| 301 |
}catch(Exception $e){
|
|
|
|
|
|
|
|
|
|
|
|
|
| 302 |
return $e;
|
| 303 |
}
|
| 304 |
}
|
|
@@ -321,8 +345,16 @@ class GAWD_google_client {
|
|
| 321 |
}
|
| 322 |
}
|
| 323 |
}
|
|
|
|
|
|
|
| 324 |
|
| 325 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 326 |
if (0 == sizeof($all_dimensions)) {
|
| 327 |
if ($default == 'default') {
|
| 328 |
update_option('gawd_custom_dimensions', "no_custom_dimensions_exist");
|
|
@@ -477,6 +509,12 @@ class GAWD_google_client {
|
|
| 477 |
return $all_filters;
|
| 478 |
}
|
| 479 |
} catch (Exception $e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 480 |
$error = array('error_message' => 'Error');
|
| 481 |
if (strpos($e->getMessage(), 'User does not have sufficient permissions for this ')) {
|
| 482 |
$error['error_message'] = 'User does not have sufficient permissions for this profile';
|
|
@@ -495,6 +533,11 @@ class GAWD_google_client {
|
|
| 495 |
$goals = $this->analytics_member->management_goals->listManagementGoals($accountId, $webPropertyId, $profileId)->getItems();
|
| 496 |
} catch (Exception $e) {
|
| 497 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 498 |
}
|
| 499 |
if (0 == sizeof($goals)) {
|
| 500 |
return "no_goals_exist";
|
|
@@ -518,6 +561,11 @@ class GAWD_google_client {
|
|
| 518 |
$goals = $this->analytics_member->management_goals->listManagementGoals($accountId, $webPropertyId, '~all')->getItems();
|
| 519 |
} catch (Exception $e) {
|
| 520 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 521 |
}
|
| 522 |
if (0 == sizeof($goals)) {
|
| 523 |
return "no_goals_exist";
|
|
@@ -603,12 +651,25 @@ class GAWD_google_client {
|
|
| 603 |
try {
|
| 604 |
$analytics->management_customDimensions->insert($accountId, $webPropertyId, $custom_dimension);
|
| 605 |
} catch (apiServiceException $e) {
|
| 606 |
-
|
| 607 |
. $e->getCode() . ':' . $e->getMessage();
|
| 608 |
} catch (apiException $e) {
|
| 609 |
-
|
| 610 |
. $e->getCode() . ':' . $e->getMessage();
|
| 611 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 612 |
}
|
| 613 |
|
| 614 |
public function add_goal($gawd_goal_profile, $goal_max_id, $gawd_goal_type, $gawd_goal_name, $gawd_goal_comparison = "GREATER_THAN", $gawd_goal_value, $url_case_sensitve = 'false') {
|
|
@@ -647,7 +708,7 @@ class GAWD_google_client {
|
|
| 647 |
$detailssetComparisonType
|
| 648 |
//$details->setEventConditions($gawd_goal_comparison);//VISIT_TIME_ON_SITE -------- LESS_THAN/ GREATER_THAN------
|
| 649 |
//$details->setUseEventValue($gawd_goal_value); */
|
| 650 |
-
|
| 651 |
}
|
| 652 |
|
| 653 |
//Set the time on site details.
|
|
@@ -660,13 +721,17 @@ class GAWD_google_client {
|
|
| 660 |
try {
|
| 661 |
$analytics->management_goals->insert($accountId, $webPropertyId, $profileId, $goal);
|
| 662 |
} catch (apiServiceException $e) {
|
| 663 |
-
|
| 664 |
. $e->getCode() . ':' . $e->getMessage();
|
| 665 |
} catch (apiException $e) {
|
| 666 |
-
|
| 667 |
. $e->getCode() . ':' . $e->getMessage();
|
| 668 |
}
|
| 669 |
catch (Exception $e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 670 |
$error = array('error_message' => $e->getMessage());
|
| 671 |
if (strpos($e->getMessage(), 'User does not have permission to perform this operation')) {
|
| 672 |
$error['error_message'] = 'User does not have permission to perform this operation';
|
|
@@ -711,12 +776,18 @@ class GAWD_google_client {
|
|
| 711 |
$res = $analytics->management_profileFilterLinks->insert($accountId, $webPropertyId, $profileId, $filterData);
|
| 712 |
|
| 713 |
} catch (apiServiceException $e) {
|
| 714 |
-
|
| 715 |
. $e->getCode() . ':' . $e->getMessage();
|
| 716 |
} catch (apiException $e) {
|
| 717 |
-
|
| 718 |
. $e->getCode() . ':' . $e->getMessage();
|
| 719 |
} catch (Exception $e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 720 |
echo '<script>window.location.href="' . admin_url() . 'admin.php?page=gawd_settings&errorMsg=1#gawd_filters_tab";</script>';
|
| 721 |
}
|
| 722 |
}
|
|
@@ -735,6 +806,12 @@ class GAWD_google_client {
|
|
| 735 |
)
|
| 736 |
);
|
| 737 |
} catch (Exception $e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 738 |
$error = array('error_message' => 'Error');
|
| 739 |
if (strpos($e->getMessage(), 'User does not have sufficient permissions for this profile')) {
|
| 740 |
$error['error_message'] = 'User does not have sufficient permissions for this profile';
|
|
@@ -807,7 +884,13 @@ class GAWD_google_client {
|
|
| 807 |
)
|
| 808 |
);
|
| 809 |
} catch (Exception $e) {
|
| 810 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 811 |
if (strpos($e->getMessage(), 'User does not have sufficient permissions for this profile')) {
|
| 812 |
$error['error_message'] = 'User does not have sufficient permissions for this profile';
|
| 813 |
}
|
|
@@ -1056,6 +1139,10 @@ class GAWD_google_client {
|
|
| 1056 |
);
|
| 1057 |
|
| 1058 |
} catch (Exception $e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1059 |
$error = array('error_message' => 'Error');
|
| 1060 |
if (strpos($e->getMessage(), 'Selected dimensions and metrics cannot be queried together')) {
|
| 1061 |
$error['error_message'] = 'Selected dimensions and metrics cannot be queried together';
|
|
@@ -1293,12 +1380,20 @@ class GAWD_google_client {
|
|
| 1293 |
if ($dimension == 'date') {
|
| 1294 |
$metric = 'ga:users,ga:sessions,ga:percentNewSessions,ga:bounceRate,ga:pageviews,ga:avgSessionDuration,ga:pageviewsPerSession';
|
| 1295 |
}
|
| 1296 |
-
|
| 1297 |
-
|
| 1298 |
-
'
|
| 1299 |
-
|
| 1300 |
-
|
| 1301 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1302 |
$rows = $results->getRows();
|
| 1303 |
$metric = explode(',', $metric);
|
| 1304 |
if ($rows) {
|
|
@@ -1425,6 +1520,11 @@ class GAWD_google_client {
|
|
| 1425 |
);
|
| 1426 |
} catch (Exception $e) {
|
| 1427 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1428 |
$error = array('error_message' => 'Error');
|
| 1429 |
if (strpos($e->getMessage(), 'User does not have sufficient permissions for this profile')) {
|
| 1430 |
$error['error_message'] = 'User does not have sufficient permissions for this profile';
|
|
@@ -1591,6 +1691,12 @@ class GAWD_google_client {
|
|
| 1591 |
try {
|
| 1592 |
$data = $analytics->data_realtime->get('ga:' . $profileId, $metrics, array('dimensions' => $dimensions, 'quotaUser' => $managequota . 'p' . $profileId));
|
| 1593 |
} catch (Exception $e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1594 |
$error = array('error_message' => 'Error');
|
| 1595 |
if (strpos($e->getMessage(), 'User does not have sufficient permissions for this profile')) {
|
| 1596 |
$error['error_message'] = 'User does not have sufficient permissions for this profile';
|
|
@@ -1615,8 +1721,8 @@ class GAWD_google_client {
|
|
| 1615 |
}
|
| 1616 |
|
| 1617 |
public static function get_instance() {
|
| 1618 |
-
if (
|
| 1619 |
-
self::$instance = new self;
|
| 1620 |
}
|
| 1621 |
return self::$instance;
|
| 1622 |
}
|
| 21 |
$errors = $e->getErrors();
|
| 22 |
return $errors[0]["message"];
|
| 23 |
}catch(Exception $e){
|
| 24 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 25 |
+
$fh = fopen($myFile, 'a');
|
| 26 |
+
fwrite($fh, $e->getMessage(). "----constructor function".PHP_EOL);
|
| 27 |
+
fclose($fh);
|
| 28 |
return $e->getMessage();
|
| 29 |
}
|
| 30 |
}
|
| 107 |
$errors = $e->getErrors();
|
| 108 |
return $errors[0]["message"];
|
| 109 |
} catch (Exception $e) {
|
| 110 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 111 |
+
$fh = fopen($myFile, 'a');
|
| 112 |
+
fwrite($fh, $e->getMessage(). "----authenticate function".PHP_EOL);
|
| 113 |
+
fclose($fh);
|
| 114 |
return $e->getMessage();
|
| 115 |
}
|
| 116 |
}
|
| 143 |
}catch (Google_Service_Exception $e) {
|
| 144 |
//return $e->getErrors()[0]["message"];
|
| 145 |
} catch (Exception $e) {
|
| 146 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 147 |
+
$fh = fopen($myFile, 'a');
|
| 148 |
+
fwrite($fh, $e->getMessage(). "----get_management_accounts function".PHP_EOL);
|
| 149 |
+
fclose($fh);
|
| 150 |
//return $e->getMessage();
|
| 151 |
}
|
| 152 |
return $accounts_light;
|
| 159 |
return 'no_matches';
|
| 160 |
|
| 161 |
}catch(Exception $e){
|
| 162 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 163 |
+
$fh = fopen($myFile, 'a');
|
| 164 |
+
fwrite($fh, $e->getMessage(). "----property_exists function".PHP_EOL);
|
| 165 |
+
fclose($fh);
|
| 166 |
return 'no_matches';
|
| 167 |
}
|
| 168 |
$exact_properties = array();
|
| 219 |
return 'There was a general API error '
|
| 220 |
. $e->getCode() . ':' . $e->getMessage();
|
| 221 |
}catch (Exception $e) {
|
| 222 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 223 |
+
$fh = fopen($myFile, 'a');
|
| 224 |
+
fwrite($fh, $e->getMessage(). "----add_webproperty function".PHP_EOL);
|
| 225 |
+
fclose($fh);
|
| 226 |
echo $e->getCode() . ':' . $e->getMessage();
|
| 227 |
}
|
| 228 |
|
| 319 |
}catch(Google_Service_Exception $e){
|
| 320 |
return $e;
|
| 321 |
}catch(Exception $e){
|
| 322 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 323 |
+
$fh = fopen($myFile, 'a');
|
| 324 |
+
fwrite($fh, $e->getMessage(). "----get_profiles function".PHP_EOL);
|
| 325 |
+
fclose($fh);
|
| 326 |
return $e;
|
| 327 |
}
|
| 328 |
}
|
| 345 |
}
|
| 346 |
}
|
| 347 |
}
|
| 348 |
+
try{
|
| 349 |
+
$all_dimensions = $this->analytics_member->management_customDimensions->listManagementCustomDimensions($accountId, $webPropertyId)->getItems();
|
| 350 |
|
| 351 |
+
}
|
| 352 |
+
catch (Exception $e) {
|
| 353 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 354 |
+
$fh = fopen($myFile, 'a');
|
| 355 |
+
fwrite($fh, $e->getMessage(). "----get_custom_dimensions function".PHP_EOL);
|
| 356 |
+
fclose($fh);
|
| 357 |
+
}
|
| 358 |
if (0 == sizeof($all_dimensions)) {
|
| 359 |
if ($default == 'default') {
|
| 360 |
update_option('gawd_custom_dimensions', "no_custom_dimensions_exist");
|
| 509 |
return $all_filters;
|
| 510 |
}
|
| 511 |
} catch (Exception $e) {
|
| 512 |
+
|
| 513 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 514 |
+
$fh = fopen($myFile, 'a');
|
| 515 |
+
fwrite($fh, $e->getMessage(). "----get_management_filters function".PHP_EOL);
|
| 516 |
+
fclose($fh);
|
| 517 |
+
|
| 518 |
$error = array('error_message' => 'Error');
|
| 519 |
if (strpos($e->getMessage(), 'User does not have sufficient permissions for this ')) {
|
| 520 |
$error['error_message'] = 'User does not have sufficient permissions for this profile';
|
| 533 |
$goals = $this->analytics_member->management_goals->listManagementGoals($accountId, $webPropertyId, $profileId)->getItems();
|
| 534 |
} catch (Exception $e) {
|
| 535 |
|
| 536 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 537 |
+
$fh = fopen($myFile, 'a');
|
| 538 |
+
fwrite($fh, $e->getMessage(). "----get_management_goals function".PHP_EOL);
|
| 539 |
+
fclose($fh);
|
| 540 |
+
|
| 541 |
}
|
| 542 |
if (0 == sizeof($goals)) {
|
| 543 |
return "no_goals_exist";
|
| 561 |
$goals = $this->analytics_member->management_goals->listManagementGoals($accountId, $webPropertyId, '~all')->getItems();
|
| 562 |
} catch (Exception $e) {
|
| 563 |
|
| 564 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 565 |
+
$fh = fopen($myFile, 'a');
|
| 566 |
+
fwrite($fh, $e->getMessage(). "----get_default_goals function".PHP_EOL);
|
| 567 |
+
fclose($fh);
|
| 568 |
+
|
| 569 |
}
|
| 570 |
if (0 == sizeof($goals)) {
|
| 571 |
return "no_goals_exist";
|
| 651 |
try {
|
| 652 |
$analytics->management_customDimensions->insert($accountId, $webPropertyId, $custom_dimension);
|
| 653 |
} catch (apiServiceException $e) {
|
| 654 |
+
echo 'There was an Analytics API service error '
|
| 655 |
. $e->getCode() . ':' . $e->getMessage();
|
| 656 |
} catch (apiException $e) {
|
| 657 |
+
echo 'There was a general API error '
|
| 658 |
. $e->getCode() . ':' . $e->getMessage();
|
| 659 |
}
|
| 660 |
+
|
| 661 |
+
catch (Exception $e){
|
| 662 |
+
|
| 663 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 664 |
+
$fh = fopen($myFile, 'a');
|
| 665 |
+
fwrite($fh, $e->getMessage(). "----add_custom_dimension function".PHP_EOL);
|
| 666 |
+
fclose($fh);
|
| 667 |
+
|
| 668 |
+
if(strpos($e->getMessage(), 'not found.') !==false){
|
| 669 |
+
echo '<div class="notice notice-error"><p>Something went wrong.</p></div>';
|
| 670 |
+
return 'error';
|
| 671 |
+
}
|
| 672 |
+
}
|
| 673 |
}
|
| 674 |
|
| 675 |
public function add_goal($gawd_goal_profile, $goal_max_id, $gawd_goal_type, $gawd_goal_name, $gawd_goal_comparison = "GREATER_THAN", $gawd_goal_value, $url_case_sensitve = 'false') {
|
| 708 |
$detailssetComparisonType
|
| 709 |
//$details->setEventConditions($gawd_goal_comparison);//VISIT_TIME_ON_SITE -------- LESS_THAN/ GREATER_THAN------
|
| 710 |
//$details->setUseEventValue($gawd_goal_value); */
|
| 711 |
+
// $goal->setEventDetails($details);
|
| 712 |
}
|
| 713 |
|
| 714 |
//Set the time on site details.
|
| 721 |
try {
|
| 722 |
$analytics->management_goals->insert($accountId, $webPropertyId, $profileId, $goal);
|
| 723 |
} catch (apiServiceException $e) {
|
| 724 |
+
echo 'There was an Analytics API service error '
|
| 725 |
. $e->getCode() . ':' . $e->getMessage();
|
| 726 |
} catch (apiException $e) {
|
| 727 |
+
echo 'There was a general API error '
|
| 728 |
. $e->getCode() . ':' . $e->getMessage();
|
| 729 |
}
|
| 730 |
catch (Exception $e) {
|
| 731 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 732 |
+
$fh = fopen($myFile, 'a');
|
| 733 |
+
fwrite($fh, $e->getMessage(). "----add goal function".PHP_EOL);
|
| 734 |
+
fclose($fh);
|
| 735 |
$error = array('error_message' => $e->getMessage());
|
| 736 |
if (strpos($e->getMessage(), 'User does not have permission to perform this operation')) {
|
| 737 |
$error['error_message'] = 'User does not have permission to perform this operation';
|
| 776 |
$res = $analytics->management_profileFilterLinks->insert($accountId, $webPropertyId, $profileId, $filterData);
|
| 777 |
|
| 778 |
} catch (apiServiceException $e) {
|
| 779 |
+
echo 'There was an Analytics API service error '
|
| 780 |
. $e->getCode() . ':' . $e->getMessage();
|
| 781 |
} catch (apiException $e) {
|
| 782 |
+
echo 'There was a general API error '
|
| 783 |
. $e->getCode() . ':' . $e->getMessage();
|
| 784 |
} catch (Exception $e) {
|
| 785 |
+
|
| 786 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 787 |
+
$fh = fopen($myFile, 'a');
|
| 788 |
+
fwrite($fh, $e->getMessage(). "----add_filter function".PHP_EOL);
|
| 789 |
+
fclose($fh);
|
| 790 |
+
|
| 791 |
echo '<script>window.location.href="' . admin_url() . 'admin.php?page=gawd_settings&errorMsg=1#gawd_filters_tab";</script>';
|
| 792 |
}
|
| 793 |
}
|
| 806 |
)
|
| 807 |
);
|
| 808 |
} catch (Exception $e) {
|
| 809 |
+
|
| 810 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 811 |
+
$fh = fopen($myFile, 'a');
|
| 812 |
+
fwrite($fh, $e->getMessage(). "----get_country_data function".PHP_EOL);
|
| 813 |
+
fclose($fh);
|
| 814 |
+
|
| 815 |
$error = array('error_message' => 'Error');
|
| 816 |
if (strpos($e->getMessage(), 'User does not have sufficient permissions for this profile')) {
|
| 817 |
$error['error_message'] = 'User does not have sufficient permissions for this profile';
|
| 884 |
)
|
| 885 |
);
|
| 886 |
} catch (Exception $e) {
|
| 887 |
+
|
| 888 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 889 |
+
$fh = fopen($myFile, 'a');
|
| 890 |
+
fwrite($fh, $e->getMessage(). "----get_post_page_data function".PHP_EOL);
|
| 891 |
+
fclose($fh);
|
| 892 |
+
|
| 893 |
+
$error = array('error_message' => 'Error');
|
| 894 |
if (strpos($e->getMessage(), 'User does not have sufficient permissions for this profile')) {
|
| 895 |
$error['error_message'] = 'User does not have sufficient permissions for this profile';
|
| 896 |
}
|
| 1139 |
);
|
| 1140 |
|
| 1141 |
} catch (Exception $e) {
|
| 1142 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 1143 |
+
$fh = fopen($myFile, 'a');
|
| 1144 |
+
fwrite($fh, $e->getMessage(). "----get_data function".PHP_EOL);
|
| 1145 |
+
fclose($fh);
|
| 1146 |
$error = array('error_message' => 'Error');
|
| 1147 |
if (strpos($e->getMessage(), 'Selected dimensions and metrics cannot be queried together')) {
|
| 1148 |
$error['error_message'] = 'Selected dimensions and metrics cannot be queried together';
|
| 1380 |
if ($dimension == 'date') {
|
| 1381 |
$metric = 'ga:users,ga:sessions,ga:percentNewSessions,ga:bounceRate,ga:pageviews,ga:avgSessionDuration,ga:pageviewsPerSession';
|
| 1382 |
}
|
| 1383 |
+
try{
|
| 1384 |
+
$results = $analytics->data_ga->get(
|
| 1385 |
+
'ga:' . $profileId, $start_date, $end_date, $metric, array(
|
| 1386 |
+
'dimensions' => 'ga:' . $dimension,
|
| 1387 |
+
'sort' => 'ga:' . $dimension,
|
| 1388 |
+
)
|
| 1389 |
+
);
|
| 1390 |
+
}
|
| 1391 |
+
catch (Exception $e) {
|
| 1392 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 1393 |
+
$fh = fopen($myFile, 'a');
|
| 1394 |
+
fwrite($fh, $e->getMessage(). "----get_data_compact function".PHP_EOL);
|
| 1395 |
+
fclose($fh);
|
| 1396 |
+
}
|
| 1397 |
$rows = $results->getRows();
|
| 1398 |
$metric = explode(',', $metric);
|
| 1399 |
if ($rows) {
|
| 1520 |
);
|
| 1521 |
} catch (Exception $e) {
|
| 1522 |
|
| 1523 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 1524 |
+
$fh = fopen($myFile, 'a');
|
| 1525 |
+
fwrite($fh, $e->getMessage(). "----get_page_data function".PHP_EOL);
|
| 1526 |
+
fclose($fh);
|
| 1527 |
+
|
| 1528 |
$error = array('error_message' => 'Error');
|
| 1529 |
if (strpos($e->getMessage(), 'User does not have sufficient permissions for this profile')) {
|
| 1530 |
$error['error_message'] = 'User does not have sufficient permissions for this profile';
|
| 1691 |
try {
|
| 1692 |
$data = $analytics->data_realtime->get('ga:' . $profileId, $metrics, array('dimensions' => $dimensions, 'quotaUser' => $managequota . 'p' . $profileId));
|
| 1693 |
} catch (Exception $e) {
|
| 1694 |
+
|
| 1695 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 1696 |
+
$fh = fopen($myFile, 'a');
|
| 1697 |
+
fwrite($fh, $e->getMessage(). "----gawd_realtime_data function".PHP_EOL);
|
| 1698 |
+
fclose($fh);
|
| 1699 |
+
|
| 1700 |
$error = array('error_message' => 'Error');
|
| 1701 |
if (strpos($e->getMessage(), 'User does not have sufficient permissions for this profile')) {
|
| 1702 |
$error['error_message'] = 'User does not have sufficient permissions for this profile';
|
| 1721 |
}
|
| 1722 |
|
| 1723 |
public static function get_instance() {
|
| 1724 |
+
if (null === self::$instance) {
|
| 1725 |
+
self::$instance = new self();
|
| 1726 |
}
|
| 1727 |
return self::$instance;
|
| 1728 |
}
|
admin/tracking.php
CHANGED
|
@@ -111,7 +111,7 @@ echo "/* WEB DORADO GOOGLE ANALYTICS TRACKING CODE */";
|
|
| 111 |
ga('send', 'pageview');
|
| 112 |
<?php } ?>
|
| 113 |
jQuery(document).ready(function () {
|
| 114 |
-
jQuery(window).load
|
| 115 |
<?php if (isset($gawd_settings['gawd_file_formats']) && $gawd_settings['gawd_file_formats'] != '') { ?>
|
| 116 |
//Track Downloads
|
| 117 |
jQuery('a').filter(function () {
|
| 111 |
ga('send', 'pageview');
|
| 112 |
<?php } ?>
|
| 113 |
jQuery(document).ready(function () {
|
| 114 |
+
jQuery(window).on('load',function () {
|
| 115 |
<?php if (isset($gawd_settings['gawd_file_formats']) && $gawd_settings['gawd_file_formats'] != '') { ?>
|
| 116 |
//Track Downloads
|
| 117 |
jQuery('a').filter(function () {
|
gawd_class.php
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
require_once(GAWD_DIR . '/admin/gawd_google_class.php');
|
| 3 |
|
| 4 |
class GAWD
|
|
@@ -689,7 +690,7 @@ class GAWD
|
|
| 689 |
$permission, //$capability
|
| 690 |
'gawd_analytics', //$menu_slug
|
| 691 |
array($this, $this->gawd_set_display('gawd_display_overview_page')), //$function = '',
|
| 692 |
-
GAWD_URL . '/assets/main_icon.png', 25, 13);
|
| 693 |
add_submenu_page(
|
| 694 |
'gawd_analytics', //$parent_slug
|
| 695 |
__('Overview', 'gawd'), //$page_title
|
|
@@ -1452,6 +1453,10 @@ class GAWD
|
|
| 1452 |
$errors = $e->getErrors();
|
| 1453 |
return $errors[0]["message"];
|
| 1454 |
} catch (Exception $e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1455 |
return $e->getMessage();
|
| 1456 |
}
|
| 1457 |
$gawd_alert_remove = isset($_POST['gawd_alert_remove']) ? intval($_POST['gawd_alert_remove']) : false;
|
|
@@ -1498,6 +1503,10 @@ class GAWD
|
|
| 1498 |
print 'There was a general API error '
|
| 1499 |
. $e->getCode() . ':' . $e->getMessage();
|
| 1500 |
} catch (Exception $e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1501 |
echo '<script>window.location.href="' . admin_url() . 'admin.php?page=gawd_settings&errorMsg=1#gawd_filters_tab";</script>';
|
| 1502 |
}
|
| 1503 |
}
|
|
@@ -2349,10 +2358,17 @@ class GAWD
|
|
| 2349 |
$accountId = $gawd_client->get_default_accountId();
|
| 2350 |
$webPropertyId = $gawd_client->get_default_webPropertyId();
|
| 2351 |
$screen = get_current_screen();
|
| 2352 |
-
if (strpos($screen->base, 'gawd') !== false && $accountId != null && $webPropertyId != null) {
|
| 2353 |
try {
|
| 2354 |
$deleted = $gawd_client->analytics_member->management_webproperties->get($accountId, $webPropertyId);
|
| 2355 |
} catch (Exception $e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2356 |
if (strpos($e->getMessage(), 'not found.') !== false) {
|
| 2357 |
echo '<div class="notice notice-error"><p>You have deleted your web-properties with current site url, please <a href="' . admin_url() . 'admin.php?page=gawd_settings">reauthenticate</a>. </p></div>';
|
| 2358 |
}
|
|
@@ -2412,4 +2428,4 @@ class GAWD
|
|
| 2412 |
private function __wakeup()
|
| 2413 |
{
|
| 2414 |
}
|
| 2415 |
-
}
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
require_once(GAWD_DIR . '/admin/gawd_google_class.php');
|
| 4 |
|
| 5 |
class GAWD
|
| 690 |
$permission, //$capability
|
| 691 |
'gawd_analytics', //$menu_slug
|
| 692 |
array($this, $this->gawd_set_display('gawd_display_overview_page')), //$function = '',
|
| 693 |
+
GAWD_URL . '/assets/main_icon.png', "25, 13");
|
| 694 |
add_submenu_page(
|
| 695 |
'gawd_analytics', //$parent_slug
|
| 696 |
__('Overview', 'gawd'), //$page_title
|
| 1453 |
$errors = $e->getErrors();
|
| 1454 |
return $errors[0]["message"];
|
| 1455 |
} catch (Exception $e) {
|
| 1456 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 1457 |
+
$fh = fopen($myFile, 'a');
|
| 1458 |
+
fwrite($fh, $e->getMessage(). "----gawd_display_settings_page function".PHP_EOL);
|
| 1459 |
+
fclose($fh);
|
| 1460 |
return $e->getMessage();
|
| 1461 |
}
|
| 1462 |
$gawd_alert_remove = isset($_POST['gawd_alert_remove']) ? intval($_POST['gawd_alert_remove']) : false;
|
| 1503 |
print 'There was a general API error '
|
| 1504 |
. $e->getCode() . ':' . $e->getMessage();
|
| 1505 |
} catch (Exception $e) {
|
| 1506 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
|
| 1507 |
+
$fh = fopen($myFile, 'a');
|
| 1508 |
+
fwrite($fh, $e->getMessage(). "----check_property_delete function get_profile_accountId".PHP_EOL);
|
| 1509 |
+
fclose($fh);
|
| 1510 |
echo '<script>window.location.href="' . admin_url() . 'admin.php?page=gawd_settings&errorMsg=1#gawd_filters_tab";</script>';
|
| 1511 |
}
|
| 1512 |
}
|
| 2358 |
$accountId = $gawd_client->get_default_accountId();
|
| 2359 |
$webPropertyId = $gawd_client->get_default_webPropertyId();
|
| 2360 |
$screen = get_current_screen();
|
| 2361 |
+
if (strpos($screen->base, 'gawd') !== false && $accountId != null && $webPropertyId != null && $gawd_client->analytics_member->management_webproperties != null ) {
|
| 2362 |
try {
|
| 2363 |
$deleted = $gawd_client->analytics_member->management_webproperties->get($accountId, $webPropertyId);
|
| 2364 |
} catch (Exception $e) {
|
| 2365 |
+
|
| 2366 |
+
$myFile = GAWD_UPLOAD_DIR."/logfile.txt";
|
| 2367 |
+
|
| 2368 |
+
$fh = fopen($myFile, 'a');
|
| 2369 |
+
fwrite($fh, $e->getMessage(). "----check_property_delete function".PHP_EOL);
|
| 2370 |
+
fclose($fh);
|
| 2371 |
+
|
| 2372 |
if (strpos($e->getMessage(), 'not found.') !== false) {
|
| 2373 |
echo '<div class="notice notice-error"><p>You have deleted your web-properties with current site url, please <a href="' . admin_url() . 'admin.php?page=gawd_settings">reauthenticate</a>. </p></div>';
|
| 2374 |
}
|
| 2428 |
private function __wakeup()
|
| 2429 |
{
|
| 2430 |
}
|
| 2431 |
+
}
|
google-analytics-wd.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
* Plugin Name: Google Analytics
|
| 5 |
* Plugin URI: https://web-dorado.com/products/wordpress-google-analytics-plugin.html
|
| 6 |
* Description: Google Analytics WD is a user-friendly all in one plugin, which allows to manage and monitor your website analytics from WordPress dashboard.
|
| 7 |
-
* Version: 1.0.
|
| 8 |
* Author: WebDorado
|
| 9 |
* Author URI: https://web-dorado.com
|
| 10 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
|
@@ -26,7 +26,20 @@ if (!defined('GAWD_INC')) {
|
|
| 26 |
}
|
| 27 |
|
| 28 |
if (!defined('GAWD_VERSION')) {
|
| 29 |
-
define('GAWD_VERSION', '1.0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
}
|
| 31 |
|
| 32 |
require_once( 'gawd_class.php' );
|
| 4 |
* Plugin Name: Google Analytics
|
| 5 |
* Plugin URI: https://web-dorado.com/products/wordpress-google-analytics-plugin.html
|
| 6 |
* Description: Google Analytics WD is a user-friendly all in one plugin, which allows to manage and monitor your website analytics from WordPress dashboard.
|
| 7 |
+
* Version: 1.0.14
|
| 8 |
* Author: WebDorado
|
| 9 |
* Author URI: https://web-dorado.com
|
| 10 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
| 26 |
}
|
| 27 |
|
| 28 |
if (!defined('GAWD_VERSION')) {
|
| 29 |
+
define('GAWD_VERSION', '1.0.14');
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
$upload_dir = wp_upload_dir();
|
| 35 |
+
if (!is_dir($upload_dir['basedir'] . '/' . plugin_basename(dirname(__FILE__)))) {
|
| 36 |
+
mkdir($upload_dir['basedir'] . '/' . plugin_basename(dirname(__FILE__)), 0777);
|
| 37 |
+
}
|
| 38 |
+
$GAWD_UPLOAD_DIR = $upload_dir['basedir'] . '/' . plugin_basename(dirname(__FILE__));
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
if (!defined('GAWD_UPLOAD_DIR')) {
|
| 42 |
+
define('GAWD_UPLOAD_DIR', $GAWD_UPLOAD_DIR);
|
| 43 |
}
|
| 44 |
|
| 45 |
require_once( 'gawd_class.php' );
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-google-analytics-plugin.h
|
|
| 4 |
Tags: google analytics, google analytics dashboard, statistics, tracking, analytics, analytics dashboard, stats, ga, googleanalytics, ecommerce tracking, custom reports, custom dimensions
|
| 5 |
Requires at least: 3.9
|
| 6 |
Tested up to: 4.7
|
| 7 |
-
Stable tag: 1.0.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -100,6 +100,11 @@ Upgrade to Google Analytics WD Pro for premium features:
|
|
| 100 |
|
| 101 |
== Changelog ==
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
= 1.0.13 =
|
| 104 |
* Fixed: Bug on Custom code option in tracking
|
| 105 |
|
| 4 |
Tags: google analytics, google analytics dashboard, statistics, tracking, analytics, analytics dashboard, stats, ga, googleanalytics, ecommerce tracking, custom reports, custom dimensions
|
| 5 |
Requires at least: 3.9
|
| 6 |
Tested up to: 4.7
|
| 7 |
+
Stable tag: 1.0.14
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 100 |
|
| 101 |
== Changelog ==
|
| 102 |
|
| 103 |
+
= 1.0.14 =
|
| 104 |
+
* Fixed: Analytics back end menu position conflict
|
| 105 |
+
* Fixed: Bug on deleted property check
|
| 106 |
+
* Added: Error log
|
| 107 |
+
|
| 108 |
= 1.0.13 =
|
| 109 |
* Fixed: Bug on Custom code option in tracking
|
| 110 |
|
