Fixed empty PV issue.

This commit is contained in:
Cotes Chung 2020-07-24 20:45:19 +08:00
parent aa23becd14
commit ad48a9ab06
1 changed files with 8 additions and 6 deletions

View File

@ -26,11 +26,13 @@ function countUp(min, max, destId) {
function countPV(path, rows) {
var count = 0;
for (var i = 0; i < rows.length; ++i) {
var gaPath = rows[i][0];
if (gaPath == path) { /* path format see: site.permalink */
count += parseInt(rows[i][1]);
break;
if (rows !== undefined ) {
for (var i = 0; i < rows.length; ++i) {
var gaPath = rows[i][0];
if (gaPath == path) { /* path format see: site.permalink */
count += parseInt(rows[i][1]);
break;
}
}
}
@ -59,7 +61,7 @@ function displayPageviews(data) {
}
var hasInit = getInitStatus();
var rows = data.rows;
var rows = data.rows; /* could be undefined */
if ($("#post-list").length > 0) { /* the Home page */
$(".post-preview").each(function() {