mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-03 19:57:57 +02:00
Monstra Dashboard - GA update #204
This commit is contained in:
@@ -11,14 +11,14 @@ $.monstra.ganalytics = {
|
|||||||
authScopes: 'https://www.googleapis.com/auth/analytics.readonly'
|
authScopes: 'https://www.googleapis.com/auth/analytics.readonly'
|
||||||
},
|
},
|
||||||
|
|
||||||
_gaAreas: '#authOk,#authFail,#gaSettings,#gaLoading',
|
_gaAreas: '#authOk,#authFail,#gaSettings,#gaLoading,#reauthError,#gaHelpLink',
|
||||||
_startDate: moment().subtract('days', 29),
|
_startDate: moment().subtract('days', 29),
|
||||||
_endDate: moment(),
|
_endDate: moment(),
|
||||||
|
|
||||||
init: function(data){
|
init: function(data){
|
||||||
$.extend(this.conf, data);
|
$.extend(this.conf, data);
|
||||||
$('#gaSettingsLink').click(function(){
|
$('.gaSettingsLink').click(function(){
|
||||||
$.monstra.ganalytics.show('#gaSettings');
|
$.monstra.ganalytics.show('#gaSettings,#gaHelpLink');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ $.monstra.ganalytics = {
|
|||||||
|
|
||||||
gaReportingResults: function(res){
|
gaReportingResults: function(res){
|
||||||
if (typeof res.error != 'undefined' && typeof res.error.message != 'undefined') {
|
if (typeof res.error != 'undefined' && typeof res.error.message != 'undefined') {
|
||||||
$.monstra.ganalytics.showError(res.error.message);
|
$.monstra.ganalytics.showError(res.error.message, res.error.code);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,8 +148,14 @@ $.monstra.ganalytics = {
|
|||||||
$(selector).removeClass('hide').show();
|
$(selector).removeClass('hide').show();
|
||||||
},
|
},
|
||||||
|
|
||||||
showError: function(msg){
|
showError: function(msg, errCode){
|
||||||
|
if (typeof errCode !== 'undefined' && errCode == 403) {
|
||||||
|
$.monstra.ganalytics.show('#reauthError,#gaHelpLink');
|
||||||
|
} else {
|
||||||
|
$.monstra.ganalytics.show('#gaHelpLink');
|
||||||
|
}
|
||||||
$('#gaAlerts').html(msg);
|
$('#gaAlerts').html(msg);
|
||||||
|
$('#authOk').addClass('hide');
|
||||||
},
|
},
|
||||||
|
|
||||||
setVisits: function(val){
|
setVisits: function(val){
|
||||||
|
@@ -33,7 +33,10 @@
|
|||||||
<script src="https://apis.google.com/js/client.js?onload=glibOnloadHandle"></script>
|
<script src="https://apis.google.com/js/client.js?onload=glibOnloadHandle"></script>
|
||||||
|
|
||||||
<div class="well dashboard-well">
|
<div class="well dashboard-well">
|
||||||
<div class="row"><div class="col-md-12"><h4><?php echo __('Goggle Analytics', 'system'); ?></h4></div></div>
|
<div class="row">
|
||||||
|
<div class="col-md-10"><h4><?php echo __('Goggle Analytics', 'system'); ?></h4></div>
|
||||||
|
<div class="col-md-2"><a href="#" class="gaSettingsLink"><?php echo __('Settings', 'system'); ?></a></div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
||||||
@@ -61,7 +64,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div><a href="javascript:void(0);" id="gaSettingsLink">Settings</a></div>
|
|
||||||
<div><h3>Today</h3></div>
|
<div><h3>Today</h3></div>
|
||||||
<div>Visits:<span id="gaVisits"></span></div>
|
<div>Visits:<span id="gaVisits"></span></div>
|
||||||
<div>Visitors:<span id="gaVisitors"></span></div>
|
<div>Visitors:<span id="gaVisitors"></span></div>
|
||||||
@@ -75,6 +77,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="reauthError" class="row hide">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<?php echo __('Please check your analytics settings then exit from google account and authorize with right google analytics account.', 'system'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="gaSettings" class="row hide">
|
<div id="gaSettings" class="row hide">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
@@ -94,6 +102,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="gaHelpLink" class="row hide">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<br />Google Analytics help page: <a href="https://support.google.com/analytics/?hl=en" target="_blank">https://support.google.com/analytics/?hl=en</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user