').addClass('sem-widget-ad-view-txt').append(divttl).append(divd).append(cite);
var block = $('
').addClass('sem-widget-ad-view-blk').append(image).append(divv);
var isIP = false;
if (domain instanceof Array) {
isIP = domain[0] ? false : true;
domain = domain[0] || this.parseDomainFromURL(domain[1]);
}
if (!isIP && domain) {
$(block).attr('domain', domain);
}
divStyle.append(block);
return divStyle.html();
},
displayLimits: function() {
var ret = '
' + app.conf.R_UPLIM + ' ';
return ret;
},
displayAdsCell: function(member) {
var td = $('
');
if (member.Ph != undefined && member.Ph.length > 0) {
td = $(' ').css('vertical-align', 'top');
if (member.Ds.match(/]*>/ig) && !member.Ds.match(/<\/table>/ig)) {
member.Ds = '';
member.Vu = member.Vu.replace(/<\/?b>/ig, "");
member.Vu = member.Vu.replace(/<wbr>/ig, "");
member.Vu = member.Vu.replace(/&/ig, "&");
if (member.Vu.length > 40) {
member.Vu = member.Vu.substring(0, 35) + ' ' + member.Vu.substring(35);
}
}
member.Ds = member.Ds.replace(/]*>(.+)?<\/table>/ig, "");
member.Ds = member.Ds.replace(/]*>(.+)?<\/span>/ig, "");
member.Ds = member.Ds.replace(/]*>(.+)?<\/a>/ig, "");
member.Ds = member.Ds.replace(/ $/ig, "");
member.Ds = member.Ds.replace(/ $/ig, "");
member.Tt = member.Tt.replace(/<\/a>.+/i, "");
td.html(' ' + member.Tt + ' ' + member.Ds + '
' + member.Vu + '');
return '
' + td.html() + ' ';
} else {
var td = $('
').attr({
'valign': 'middle',
'align': 'center',
'height': '72px'
});
td.html(this.displayLimits());
return ' ' + td.html() + ' ';
}
},
displayAdsBody: function(member) {
if (member.Ph != undefined && member.Ph.length > 0) {
if (member.Ds.match(/
]*>/ig) && !member.Ds.match(/<\/table>/ig)) {
member.Ds = '';
member.Vu = member.Vu.replace(/<\/?b>/ig, "");
member.Vu = member.Vu.replace(/<wbr>/ig, "");
member.Vu = member.Vu.replace(/&/ig, "&");
if (member.Vu.length > 40) {
member.Vu = member.Vu.substring(0, 35) + ' ' + member.Vu.substring(35);
}
}
member.Ds = member.Ds.replace(/]*>(.+)?<\/table>/ig, "");
member.Ds = member.Ds.replace(/]*>(.+)?<\/span>/ig, "");
member.Ds = member.Ds.replace(/]*>(.+)?<\/a>/ig, "");
member.Ds = member.Ds.replace(/ $/ig, "");
member.Ds = member.Ds.replace(/ $/ig, "");
member.Tt = member.Tt.replace(/<\/a>.+/i, "");
var html = ' ' + member.Tt + ' ' + member.Ds + '
';
html += '' + member.Vu + '
';
return html;
} else {
return '' + this.displayLimits() + '
';
}
},
displayCategory: function(categories) {
if (typeof categories == "undefined")
return;
var html = ""
, catList = categories.split(', ');
html += "";
catList.forEach(function(item) {
html += "" + item + " ";
});
html += " ";
return html;
},
getIndexes: function(values) {
if (typeof values == "undefined" || !values.length)
return;
return _.map(values.split(','), function(value) {
return parseInt(value.trim());
});
},
adsTextmediaBar: function(width, domain1, domain2, by_type, total_ads, text_ads, media_ads, title_text_ads, title_media_ads) {
if (!total_ads) {
return '';
}
var txt = Math.round(text_ads / total_ads * 100);
var img = Math.round(media_ads / total_ads * 100);
var a_txt = '0'
, a_img = '0';
var link = (domain2 ? domain1 + ' ' + domain2 : domain1);
if (txt) {
a_txt = '/info/' + link + '+(' + by_type + ')?adstype=text_ads';
a_txt = '' + txt + '% ';
}
if (img) {
a_img = '/info/' + link + '+(' + by_type + ')?adstype=media_ads';
a_img = '' + img + '% ';
}
return this.uilibDoublepercentLinkBar(width, img, a_txt, a_img);
},
uilibDoublepercentLinkBar: function(width, percents, text1, text2) {
var w50 = width / 2
, w48 = width / 2 - 2
, w49 = width / 2 - 1
, left = width * percents / 200;
return ['', '
', '
' + text1 + '
', '
' + text2 + '
', '
'].join('');
},
adsTextmediaBar1: function(width, domain1, domain2, by_type, total_ads, text_ads, media_ads, title_text_ads, title_media_ads) {
if (!total_ads) {
return '';
}
var txt = Math.round(text_ads / total_ads * 100);
var img = Math.round(media_ads / total_ads * 100);
var a_txt = '0'
, a_img = '0';
var link = (domain2 ? domain1 + ' ' + domain2 : domain1);
if (txt) {
a_txt = '/analytics/da/cross/' + domain1 + '?advertiserDomain=' + domain1 + '&publisherDomain=' + domain2 + '&detailedName=_textAds';
a_txt = '' + txt + '% ';
}
if (img) {
a_img = '/analytics/da/cross/' + domain1 + '?advertiserDomain=' + domain1 + '&publisherDomain=' + domain2 + '&detailedName=mediaAds';
a_img = '' + img + '% ';
}
var left = width * img / 200;
return "" + "
" + "
" + a_txt + "
" + "
" + a_img + "
" + "
" + "
";
return this.uilibDoublepercentLinkBar1(width, img, a_txt, a_img);
},
uilibDoublepercentLinkBar1: function(width, percents, text1, text2) {
var w50 = width / 2
, w48 = width / 2 - 2
, w49 = width / 2 - 1
, left = width * percents / 200;
return ['', '
', '
' + text1 + '
', '
' + text2 + '
', '
'].join('');
},
strToDate: function(i) {
return new Date(i.slice(0, 4),(parseInt(i.slice(4, 6), 10) - 1),i.slice(6));
},
getObjectLength: function(i) {
var l = 0, k;
for (k in i) {
if (i.hasOwnProperty(k))
l++;
}
return l;
},
updatePositionCells: function(i, differenceFlag) {
var ret = i;
if (i.length != 0 && isNaN(parseInt(i, 10)))
return "" + i + " ";
if (differenceFlag) {
ret = (parseInt(i, 10) > 0) ? "-" + i : "+" + Math.abs(i);
}
if (i.length == 0) {
return "– ";
} else if (parseInt(i, 10) == 0) {
return "0 ";
}
if (differenceFlag) {
if (parseInt(i, 10) > 0) {
return "" + ret + " ";
} else {
return "" + ret + " ";
}
}
return "" + ret + " ";
},
displDiffCell: function(i, signFlag) {
var ret;
if (signFlag) {
ret = (parseFloat(i, 10) > 0) ? "+" + i : "-" + Math.abs(i);
} else {
ret = Math.abs(i)
}
if (i.length == 0 || isNaN(parseFloat(i, 10)))
return "- ";
if (parseFloat(i, 10) < 0) {
return "" + ret + " ";
} else if (parseFloat(i, 10) > 0) {
return "" + ret + " ";
} else {
return "0 ";
}
},
positionsDifference: function(i, diff) {
var out = '';
if (isNaN(parseInt(diff, 10)) || parseInt(diff, 10) == 0 || (i.length != 0 && isNaN(parseInt(i, 10)))) {
out = " ";
return out;
}
var ret = (parseInt(diff, 10) > 0) ? "-" + diff : "+" + Math.abs(diff);
if (parseInt(diff, 10) > 0) {
out = "" + ret + " ";
} else {
out = "" + ret + " ";
}
return out;
},
getSourceHref: function(positionIndex, keyword, campaign, date, searchEngine, domain, location, type, device_group, userKey) {
if (typeof type == "undefined") {
type = "organic";
}
domain = domain.replace(/^\*?\.?/g, '');
domain = domain.replace(/\/?\*?$/g, '');
if (positionIndex == "" || !isNaN(parseInt(positionIndex, 10)) && keyword && date) {
return '/info/' + keyword + '+(source)' + '?source_type=tracking' + '&campaign_id=' + campaign + '&date_begin=' + date + '&se=' + searchEngine + '&position=' + positionIndex + '&domain=' + domain + '&location=' + location + '&type=' + type + '&device_group=' + device_group + ((userKey) ? ('&key=' + userKey) : "");
} else {
return "";
}
return "";
},
displaySourceLink: function(positionIndex, keyword, date, type, device_group, domain, location, t, userKey, readOnly) {
type = t;
var ret = ""
, url = "";
url = this.getSourceHref(positionIndex, keyword, app.TrackingData.campaignId, date, app.TrackingData.seFullName, domain, location, type, device_group, ((url && readOnly) ? userKey : ""));
ret = ' ';
return ret;
},
mapColorClass: function(val) {
if (val > 75)
return "value-9";
if (val > 50)
return "value-8";
if (val > 40)
return "value-7";
if (val > 30)
return "value-6";
if (val > 25)
return "value-5";
if (val > 20)
return "value-4";
if (val > 15)
return "value-3";
if (val > 10)
return "value-2";
if (val > 1)
return "value-1";
if (val > 0)
return "value-0";
return "";
},
stringToArray: function(string) {
return JSON.parse("[" + string + "]")
},
escapeHtml: function(str) {
return str.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'");
},
removeSpecialChars: function(str) {
return str.replace(/</ig, "<").replace(/>/ig, ">").replace(/"/ig, '"').replace(/'/g, "'").replace(/&/ig, '&');
},
displayRounded: function(anyParam) {
var calcRoundArray = this.calcRound(anyParam);
return calcRoundArray[0] + calcRoundArray[1];
},
displaySimpleDate: function(date) {
if (!date) {
return '-';
}
date = parseInt(date, 10) / 1000;
Date.now = Date.now || function() {
return +new Date;
}
;
var today = Math.round(Date.now() / 1000);
var difference = today - date;
if (difference < 0) {
return '-';
} else if (difference < 60) {
return difference + ' sec ago';
} else if (difference < 60 * 60) {
return Math.floor(difference / 60) + ' min ago';
} else if (difference < 24 * 60 * 60) {
return Math.floor(difference / 60 / 60) + ' hr ago';
} else if (difference < 7 * 24 * 60 * 60) {
difference = Math.floor(difference / 24 / 60 / 60);
return difference + ((difference == 1) ? ' day ago' : ' days ago');
} else {
date = new Date(date * 1000);
return date.getDate() + ' ' + app.conf.MONTH_SHORT_NAMES[date.getMonth()] + " " + date.getFullYear();
}
},
displaySimpleUTCDate: function(UTCString) {
return this.displaySimpleDate(new Date(UTCString).getTime());
},
displayPercents: function(piece, unit) {
var percent = (piece / unit) * 100;
return (percent > 1 ? percent.toFixed() : '1') + '%';
},
displayTimeInSeconds: function(t) {
ndate = new Date(1970,1,1,0,0,t);
return (ndate.getHours() > 0 ? this.prependZero(ndate.getHours()) + ":" : "") + this.prependZero(ndate.getMinutes()) + ":" + this.prependZero(ndate.getSeconds());
},
displayDiffDiv: function(value_diff, value, value_prev, date, date_prev, postfix, reverse) {
var sign = value_diff > 0 ? "+" : "", cssClass;
if (typeof postfix === 'undefined') {
postfix = '';
}
if (typeof reverse != 'undefined') {
cssClass = value_diff > 0 ? 'negative' : (value_diff == 0 ? "" : 'positive');
} else {
cssClass = value_diff > 0 ? 'positive' : (value_diff == 0 ? "" : 'negative');
}
var show_tooltip = false;
if (value != undefined) {
show_tooltip = true;
}
return ''
},
displayDiffDivTooltip: function(value, prev_value, date, date_prev, postfix) {
var tooltip = 'Current value: ' + value + postfix + ' (' + date + ') ' + 'Previous value: ' + prev_value + postfix + (date_prev !== '' ? ' (' + date_prev + ')' : '');
return tooltip;
},
displayVideoLength: function(timestamp) {
var date, ret = "";
if (timestamp) {
date = new Date(parseInt(timestamp, 10) * 1000);
if (date.getUTCHours() > 0) {
ret += date.getUTCHours() + ":"
}
ret += this.prependZero(date.getUTCMinutes()) + ":" + this.prependZero(date.getUTCSeconds()) + " ";
}
return ret;
},
truncateLongString: function(string) {
return truncateLongString(string, 64);
},
truncateLongString: function(str, limit) {
if (!str) {
return "";
}
return str.length > limit ? str.substr(0, limit - 1) + '…' : str;
},
formatCurrency: {
formatStringByCode: function(value, code) {
var currency = _.find(countriesCurrency, {
code: code
});
return this.formatString(value, currency.db);
},
formatString: function(value, current_db) {
this.setFormat(current_db);
if (this.format) {
var sign = '' + this.format.sign + '' + this.format.code + '
';
return this.position(value, sign);
} else {
return value;
}
},
formatShSign: function(value, current_db) {
this.setFormat(current_db);
if (this.format) {
var sign = this.getShSign();
return this.position(value, sign);
} else {
return value;
}
},
formatCode: function(current_db) {
this.setFormat(current_db);
if (this.format && this.format.hasOwnProperty('code')) {
return '(' + this.format.code + ')';
}
return '';
},
setFormat: function(current_db) {
if (countriesCurrency.hasOwnProperty(current_db)) {
this.format = countriesCurrency[current_db];
}
},
getShSign: function() {
return (this.format).hasOwnProperty('sh_sign') ? this.format.sh_sign : this.format.sign;
},
position: function(value, sign) {
if (this.format.hasOwnProperty('position') && this.format.position === 'r') {
return value + ' ' + sign;
} else if (this.format.db === "ch") {
return sign + " " + value;
}
return sign + value;
}
},
imageError: function() {
return 'this.onerror = null; this.src="' + app.conf.MEDIA_URL + '/img/image-not-found.png"';
},
muteCell: function(el, text) {
$(el).addClass('-cell-inactive').tipsy({
fallback: text,
gravity: "s"
});
},
addTooltipToMobileIcon: function(el) {
if (!$(el + " .js-icon-mobile__report").length)
return;
$(el + " .js-icon-mobile__report").each(function() {
$(this).tipsy({
fallback: 'Mobile-friendly',
gravity: "s"
});
});
},
getRestOfPercentage: function(data, col) {
var sum = _.reduce(_.pluck(_.take(data, col), 'percentage'), function(total, n) {
return total + n;
});
return sum < 100 ? Math.round((100 - sum) * 100) / 100 : 0;
},
dispBarLine: function(value) {
var html = '';
return html;
},
dispCheckFields: function(data, value) {
if (_.indexOf(data, value) < 0) {
return "";
}
return " ";
},
dispRoundedValue: function(value) {
return parseFloat(value).toFixed(2);
},
countFilteredTotal: function(data, page) {
var responce = data.responce;
if (data.length < 100) {
return (page - 1) * responce.get("limit") + data.length;
} else {
var parsed = parseInt(responce.get("parsed"), 10);
if (parsed > 0) {
var received = parseInt(responce.get("offset", 10)) + data.length
, total = parseInt(responce.get("total", 10));
if (parsed < data.length) {
parsed = received + 1;
}
return Math.ceil(received * total / parsed);
}
}
},
dispDescriptionField: function(desc) {
desc = desc.replace(/]*>(.+)?<\/span>/ig, "");
desc = desc.replace(/]*>(.+)?<\/a>/ig, "");
if (desc.match(/ ]*>/ig) && !desc.match(/<\/table>/ig))
desc = '';
desc = desc.replace(/]*>(.+)?<\/table>/ig, "");
desc = desc.replace(/ $/ig, "");
desc = desc.replace(/ $/ig, "");
return desc;
},
dispTitleField: function(txt) {
return txt.replace(/<\/a>.+/i, "");
},
displayDatabaseTitle: function(db) {
var postfix = _.startsWith(db, 'bing') ? 'Bing' : (_.startsWith(db, 'mobile') ? 'Mobile' : 'Google');
return _.toUpper(_.replace(db, /^(bing-|mobile-)/, "")) + ' ' + postfix;
},
isMobileDb: function(db) {
return _.startsWith(db, 'mobile');
}
};
return app.helper;
}
)($, app);
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_15__;
}
, function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_16__;
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(18)],
__WEBPACK_AMD_DEFINE_RESULT__ = function($) {
var cookiesUtils = {
getCookie: function(c_name) {
if (document.cookie.length > 0) {
var c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
var c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1)
c_end = document.cookie.length;
return unescape(document.cookie.substring(c_start, c_end));
}
return "";
}
return "";
},
setCookie: function(c_name, value, expiredays, domain, path='/') {
var d;
if (domain != null) {
d = document.domain.replace(/^[a-z0-9]+\./i, '');
} else {
d = document.domain;
}
if (expiredays != null) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
document.cookie = c_name + "=" + escape(value) + ";domain=" + d + ";path=" + path + ";" + ((expiredays == null) ? "" : "expires=" + exdate.toGMTString());
} else {
var futdate = new Date()
var expdate = futdate.getTime();
expdate += 3600 * 1000;
futdate.setTime(expdate);
document.cookie = c_name + "=" + escape(value) + ";domain=" + d + ";path=" + path + ";expires=" + futdate.toGMTString();
}
},
deleteCookie: function(name) {
var domain = document.domain.replace(/^[a-z0-9]+\./i, '');
var mainDomain = domain.replace('www.', '');
this.setCookie(name, 'delete', -300);
this.setCookie(name, 'delete', -300, '.' + domain);
this.setCookie(name, 'delete', -300, mainDomain);
this.setCookie(name, 'delete', -300, '.' + mainDomain);
}
};
return cookiesUtils;
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_18__;
}
, function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_19__;
}
, function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_20__;
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(22), __webpack_require__(23), __webpack_require__(16), __webpack_require__(4), __webpack_require__(17)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, CONTENT_TEMPLATE_NEW, countriesCurrency, Backbone, cookiesUtils) {
"use strict";
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
var defaultDb = 'us';
var defaultCurrency = this.getCurrencyInfo(defaultDb);
var currentDbCurrency = this.getCurrencyInfo(CONF.MIDDLE_WARE.current_db);
var currentCurrency = this.currentCurrency = CONF.MIDDLE_WARE.db_currency;
var currensyList = [];
if (currentDbCurrency.code != defaultCurrency.code) {
currensyList.push(defaultCurrency);
currensyList.push(currentDbCurrency);
}
this.collection = new Backbone.Collection(currensyList,{
model: Backbone.Model.extend({
initialize: function() {
this.isSelected();
},
isSelected: function() {
this.set('selected', (this.get('code').toLowerCase() == currentCurrency.toLowerCase()));
},
defaults: {
sign: '',
code: '',
selected: false
}
})
});
this.render();
},
render: function() {
var CONF = this.CONF
, header_template = (typeof CONF.MIDDLE_WARE.new_design !== 'undefined' && CONF.MIDDLE_WARE.new_design === true)
, widgetTemplate = (header_template) ? CONTENT_TEMPLATE_NEW : CONTENT_TEMPLATE;
if (this.collection.length > 1) {
this.$el.html(_.template(widgetTemplate)({
LOCALE: CONF.LOCALE,
MIDDLE_WARE: CONF.MIDDLE_WARE,
data: this.collection
}));
if (!header_template) {
if (this.select2_support) {
$('select', this.el).select2({
minimumResultsForSearch: -1
});
}
}
}
},
events: {
'click .js-drop-open': "openDropDown",
'click .js-btn-close': "_cancelHandler",
'click .js-btn-apply': "_selectCurrency",
'click .currency-switcher': "_openDropDownNew",
'click .js-switch-currency': "_headerSwitcher",
'click .js-currency-settings': 'stopClickEvents'
},
getCurrencyInfo: function(db) {
var info = countriesCurrency[db];
info.code = info.code.toLowerCase();
return info;
},
setCurrency: function(val) {
this.currentCurrency = val;
cookiesUtils.setCookie("db_currency", val, 365, document.domain);
},
select2_support: _.isFunction($.fn.select2),
_openDropDownNew: function(e) {
e.stopPropagation();
if ($(e.currentTarget).hasClass('-open')) {
$(document).off('click.dropdown');
} else {
$(document).on('click.dropdown', this.closeOnClickOutside.bind(this));
if (this.CONF.MIDDLE_WARE.gaCategory) {
ga('send', 'event', this.CONF.MIDDLE_WARE.gaCategory, 'currency', 'show');
}
}
$(e.currentTarget).toggleClass(' -open');
$(e.currentTarget).find('.s-select__toogle').toggleClass(' -open');
},
openDropDown: function(e) {
if ($(e.currentTarget).hasClass('-opened')) {
this._closeDropDown(e);
} else {
$(e.currentTarget).addClass('-opened');
$('.s-currency-selector__dropdown', this.el).addClass('-opened');
$(document).on('click.dropdown', this.closeOnClickOutside.bind(this));
}
},
_cancelHandler: function(e) {
this._closeDropDown(e);
},
_headerSwitcher: function(e) {
var currency = $(e.currentTarget).data('value');
$('.js-current-value', this.el).text(currency);
this.setCurrency(currency);
if (this.CONF.MIDDLE_WARE.gaCategory) {
ga('send', 'event', this.CONF.MIDDLE_WARE.gaCategory, 'currency', currency);
}
this._convertCurrency();
},
_selectCurrency: function(e) {
var currency = $('.js-currency-settings', this.el).find('select').val();
this.setCurrency(currency);
this._closeDropDown(e);
this._convertCurrency();
},
_closeDropDown: function(e) {
$('.js-drop-open', this.el).removeClass('-opened');
$('.s-currency-selector__dropdown', this.el).removeClass('-opened');
$('.currency-switcher', this.el).removeClass(' -open');
$('.currency-switcher', this.el).find('.s-select__toogle').removeClass(' -open');
$(document).off('click.dropdown');
},
_convertCurrency: function() {
location.reload();
},
closeOnClickOutside: function(e) {
this._closeDropDown(e);
},
stopClickEvents: function(e) {
e.stopPropagation();
}
})
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "\n\t
\n\t\t \n\t
\n\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t\t\t<% _.forEach(data.models, function(item) { %>\n\t\t\t\t\t selected=\"selected\"<% } %> value=\"<%= item.get('code') %>\">\n\t\t\t\t\t\t<%= item.get('code').toUpperCase() %>, <%= item.get('sign') %>\n\t\t\t\t\t \n\t\t\t\t<% }); %>\n\t\t\t \n\t\t
\n\t\t
\n\t\t\t<%= LOCALE.cancel %> \n\t\t\t<%= LOCALE.apply %> \n\t\t
\n\t
\n
"
}
, function(module, exports) {
module.exports = "\n\t
\n\t\t<%= MIDDLE_WARE.db_currency %> \n\t\t \n\t
\n\t
\n\t\t
\n\t\t\t<% _.forEach(data.models, function(item) { %>\n\t\t\t\t -active<% } %>\" data-value=\"<%= item.get('code') %>\">\n\t\t\t\t\t<%= item.get('code') %>, <%= item.get('sign') %>\n\t\t\t\t \n\t\t\t<% }); %>\n\t\t \n\t
\n
"
}
, , , , , , function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_29__;
}
, , , , , , , , , function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, HEADER_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function(type) {
return (type === 'organic_organic' ? 'Organic' : 'Paid') + ' competitive positioning';
}
var gaClickOnTitle = function(type) {
sendGa(type, 'click to title');
}
var gaClickOnChart = function(type) {
sendGa(type, 'click to chart');
}
var sendGa = function(type, label) {
var action = getGaWidgetName(type);
if (typeof ga !== 'undefined') {
ga('send', 'event', 'Domain overview', action, label);
}
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
if (!CONF.MIDDLE_WARE.limit_display) {
CONF.MIDDLE_WARE.limit_display = 0;
}
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.title,
tooltip: CONF.LOCALE.title_tooltip,
title_href: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+" + CONF.MIDDLE_WARE.type + ")",
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
needToLogNothingFound: true,
typeToLog: "domain_overview_" + CONF.MIDDLE_WARE.type,
gaLabel: getGaWidgetName(CONF.MIDDLE_WARE.type) + ' - Overview',
reports: [{
back: (function() {
var foo = {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
action: "report",
type: "domain_overview_" + CONF.MIDDLE_WARE.type,
responceAction: "overview_" + CONF.MIDDLE_WARE.type,
display_sort: "tr_desc"
};
if (CONF.MIDDLE_WARE.exportHash) {
foo.display_hash = CONF.MIDDLE_WARE.exportHash;
}
if (CONF.MIDDLE_WARE.api_display_date && CONF.MIDDLE_WARE.api_display_date !== 'current') {
foo.display_date = CONF.MIDDLE_WARE.api_display_date;
}
return foo;
}
)()
}, {
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
action: "report",
type: "domain_rank",
responceAction: "rank"
}
}],
templates: {
widget: function() {
var header = this.template("header")
, footer = this.template("footer")
, ret = "";
if (header) {
ret += "";
}
ret += "";
ret += "
";
if (this.noResults) {
ret += this.template("noResults");
} else if (this.serverError) {
ret += this.template("serverError");
} else {
ret += this.template("content");
}
ret += "
";
if (footer) {
ret += "";
}
return ret;
},
header: (CONF.LOCALE.title && CONF.LOCALE.title !== "" ? HEADER_TEMPLATE : "")
},
chartOptions: {
colors: ['#afd3ed', '#7ac573', '#f599c3', '#f79052', '#7da5d9'],
chart: {
backgroundColor: CONF.MIDDLE_WARE.show_watermark ? null : '#fff',
type: 'bubble',
height: CONF.MIDDLE_WARE.height,
spacingTop: 27,
spacingLeft: -5,
spacingRight: 0,
spacingBottom: 9
},
title: {
text: null
},
legend: {
enabled: false
},
tooltip: {
formatter: function() {
return "" + this.point.series.name + " " + CONF.LOCALE.tooltip_x + ": " + app.helper.roundNumRankNew(this.point.x) + " " + CONF.LOCALE.tooltip_y + ": " + app.helper.roundNumRankNew(this.point.y);
}
},
xAxis: {
min: -1,
minTickInterval: 1,
gridLineWidth: 0,
tickPixelInterval: 200,
showFirstLabel: false,
title: {
align: "low",
text: CONF.LOCALE.title_x,
margin: -7,
style: {
color: '#53a5e0',
fontFamily: 'Ubuntu, Arial',
fontSize: 12
}
},
lineColor: '#cccccc',
labels: {
y: 20,
style: {
fontSize: 12,
color: '#999999'
},
formatter: function() {
return (app.helper.roundNumRankNew(this.value) + '').toUpperCase();
}
},
tickWidth: 0,
type: "linear"
},
yAxis: {
labels: {
x: 0,
y: -5,
align: "left",
style: {
fontSize: 12,
color: '#999999'
},
formatter: function() {
return (app.helper.roundNumRankNew(this.value) + '').toUpperCase();
}
},
title: {
text: CONF.LOCALE.title_y,
x: 5,
style: {
color: '#53a5e0',
fontFamily: 'Ubuntu, Arial',
fontSize: 12
}
},
type: "logarithmic",
min: 0
},
plotOptions: {
bubble: {
minSize: '15%',
maxSize: '35%',
dataLabels: {
enabled: true,
formatter: function() {
return this.series.name;
},
rotation: 35,
style: {
textShadow: 'none',
color: '#333333'
},
crop: false,
overflow: "none"
}
},
series: {
events: {
click: function(event) {
gaClickOnChart(CONF.MIDDLE_WARE.type);
document.location = app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + event.point.series.name;
}
}
}
}
},
getData: function(backendReports) {
var backendModel, backendModelR, ret = [], min, keywords = CONF.MIDDLE_WARE.type == "organic_organic" ? "Or" : "Ad", traffic = CONF.MIDDLE_WARE.type == "organic_organic" ? "Ot" : "At";
_.each(backendReports.toJSON(), function(model) {
if (model.type === "domain_rank" && typeof model.responce.attributes !== "undefined") {
backendModelR = model;
} else if (model.type === "domain_overview_" + CONF.MIDDLE_WARE.type && typeof model.responce.attributes !== "undefined") {
backendModel = model;
}
});
if (typeof backendModel !== "undefined" && backendModel.length) {
min = parseInt(backendModel.first().get(traffic), 10);
_.map(backendModel.models, function(item) {
if (ret.length < 10) {
ret.push({
name: item.get("Dn"),
data: [[parseInt(item.get(keywords), 10), parseInt(item.get(traffic), 10) ? parseInt(item.get(traffic), 10) : 0.00001, parseInt(item.get(traffic), 10) ? parseInt(item.get(traffic), 10) : 0.00001]]
});
}
if (min > parseInt(item.get(traffic), 10)) {
min = parseInt(item.get(traffic), 10);
}
})
}
this.options.chartOptions.yAxis.min = min || 1;
if (typeof backendModelR !== "undefined" && backendModelR.length) {
ret.push({
name: backendModelR.first().get("Dn"),
data: [[parseInt(backendModelR.first().get(keywords), 10), parseInt(backendModelR.first().get(traffic), 10) ? parseInt(backendModelR.first().get(traffic), 10) : 0.00001, parseInt(backendModelR.first().get(traffic), 10) ? parseInt(backendModelR.first().get(traffic), 10) : 0.00001]],
marker: {
lineWidth: 3
}
});
}
return ret;
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
var CONF = this.CONF;
return new (app.ReportChart.extend({
events: {
"click .sem-widget-try-again": "tryAgainHandler",
'click .sem-widget-header-title a': function(e) {
gaClickOnTitle(CONF.MIDDLE_WARE.type);
},
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "<% if (typeof options.title != \"undefined\") { %>\n\t\n<% } else { %>\n
\n<% } %>\n"
}
, , , , , , function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(46), __webpack_require__(47), __webpack_require__(4), __webpack_require__(17), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, TOOLTIP_TEMPLATE, HEADER_TEMPLATE, Backbone, cookiesUtils) {
"use strict";
var gaClickOnChart = function(type, range, value) {
var action = 'Click on chart';
var date = value.getUTCDate() + '.' + (value.getUTCMonth() + 1) + '.' + value.getUTCFullYear();
var label = 'click to ' + type + ' traffic - ' + range + ' - ' + date;
if (typeof ga !== 'undefined') {
ga('send', 'event', 'Domain overview', action, label);
}
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
cookiesUtils.deleteCookie("selectedVsTypeLine");
cookiesUtils.deleteCookie("selectedTypeLine");
cookiesUtils.deleteCookie("selectedTypeDate");
var CONF = this.CONF = options
, _this = this;
if (_.indexOf(CONF.MIDDLE_WARE.typeLine, CONF.MIDDLE_WARE.selectedTypeLine) == -1) {
if (CONF.MIDDLE_WARE.selectedTypeLine == 'Ad') {
CONF.MIDDLE_WARE.selectedTypeLine = 'Or';
} else if (CONF.MIDDLE_WARE.selectedTypeLine == 'Or') {
CONF.MIDDLE_WARE.selectedTypeLine = 'Ad';
} else {
CONF.MIDDLE_WARE.selectedTypeLine = _.first(CONF.MIDDLE_WARE.typeLine);
}
}
var clickOnChart = function(event) {
var date = new Date(event.point.x);
var gaType;
var href = CONF.MIDDLE_WARE.db_prefix;
if (CONF.MIDDLE_WARE.selectedTypeDate !== "30d") {
href += "/" + date.getUTCFullYear() + ("0" + (date.getUTCMonth() + 1)).slice(-2);
}
href += "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+";
switch (event.currentTarget.options.className.substr(0, 1)) {
case "O":
href += "organic)";
gaType = 'organic';
break;
case "A":
href += "adwords)";
gaType = 'paid';
break;
default:
href += "shopping)";
gaType = 'pla';
}
gaClickOnChart(gaType, CONF.MIDDLE_WARE.selectedTypeDate, date);
if (CONF.MIDDLE_WARE.selectedTypeDate == "30d") {
href += "?date=" + date.getUTCFullYear() + ("0" + (date.getUTCMonth() + 1)).slice(-2) + ("0" + date.getUTCDate()).slice(-2);
if (event.currentTarget.options.className.substr(0, 1) == "S") {
return;
}
}
document.location = href;
};
var prepareDataLine = function(backendReports, typeLine, typeDate) {
var data, postfixes = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a"];
if (typeof typeLine != "undefined") {
var minDate = new Date(), ndate;
minDate.setDate(minDate.getDate() - 1);
switch (typeDate) {
case "2y":
minDate.setMonth(minDate.getMonth() - 24);
break;
case "1y":
minDate.setMonth(minDate.getMonth() - 12);
break;
case "6m":
minDate.setMonth(minDate.getMonth() - 6);
break;
case "30d":
minDate.setMonth(minDate.getMonth() - 1);
break;
default:
minDate.setYear(1970);
}
data = _.compact(backendReports.models.map(function(val, index) {
var retval = [];
if (typeof val.get("Dt") != "undefined") {
ndate = new Date(Date.parse(val.get("Dt").replace(/^(\d{4})(\d{2})(\d{2})$/, "$1/$2/$3 12:00:00")));
} else {
ndate = new Date();
}
if (typeDate != "30d") {
ndate.setDate(1);
}
retval.push(Date.UTC(ndate.getFullYear(), ndate.getMonth(), ndate.getDate()));
if (typeLine != "Or" && typeLine != "Ad") {
var res = parseInt(val.get(typeLine), 10);
if (typeLine === 'At' && typeDate === '30d') {
res = _.isNaN(res) ? 0 : res;
}
retval.push(res);
}
var keywords = 0, j;
if (typeof _this.selectedVsTypeLine == "undefined" && CONF.MIDDLE_WARE.show_positions && typeLine == "Ad") {
for (j = 0; j < postfixes.length; j++) {
if (j === 3 || j === 8) {
retval.push(keywords);
keywords = 0;
}
keywords += parseInt(val.get("Y" + postfixes[j]));
}
retval.push(keywords);
} else if (typeof _this.selectedVsTypeLine == "undefined" && CONF.MIDDLE_WARE.show_positions && typeLine == "Or") {
for (j = 0; j < postfixes.length; j++) {
if (j < 3) {
retval.push(parseInt(val.get("X" + postfixes[j])));
}
if (j >= 3 && j < 5) {
keywords += parseInt(val.get("X" + postfixes[j]));
}
if (j == 5) {
keywords += parseInt(val.get("X" + postfixes[j]));
retval.push(keywords);
keywords = 0;
}
if (j > 5) {
keywords += parseInt(val.get("X" + postfixes[j]));
}
if (postfixes[j] == 'a') {
retval.push(keywords);
}
}
}
if (ndate > minDate && !isNaN(retval[1])) {
return retval;
} else {
return null;
}
}));
data = _.sortBy(data, function(arr) {
return arr[0];
});
}
if (typeof data !== "undefined" && data.length) {
return data;
} else {
return false;
}
};
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.title,
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
reports: [{
back: function() {
var foo = {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
display_hash: CONF.MIDDLE_WARE.exportHash,
action: "report",
type: "domain_rank_history",
display_sort: 'dt_desc',
responceAction: "rank_history"
};
if (CONF.MIDDLE_WARE.db_currency) {
foo.currency = CONF.MIDDLE_WARE.db_currency;
}
return foo;
}()
}, {
back: function() {
var foo = {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
display_hash: CONF.MIDDLE_WARE.exportHash,
action: "report",
type: "domain_rank_history",
responceAction: "rank_history",
display_sort: 'dt_desc',
display_daily: "1"
};
if (CONF.MIDDLE_WARE.db_currency) {
foo.currency = CONF.MIDDLE_WARE.db_currency;
}
return foo;
}()
}, {
back: function() {
var foo = {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
display_hash: CONF.MIDDLE_WARE.exportHashR,
action: "report",
type: "domain_rank",
responceAction: "rank"
};
if (CONF.MIDDLE_WARE.db_currency) {
foo.currency = CONF.MIDDLE_WARE.db_currency;
}
return foo;
}()
}],
chartOptions: {
chart: {
backgroundColor: CONF.MIDDLE_WARE.show_watermark ? null : '#fff',
zoomType: "xy",
height: CONF.MIDDLE_WARE.height,
spacingTop: 10,
spacingLeft: 0,
spacingRight: 0,
spacingBottom: 10,
events: {
load: function(event) {
var seriesIndex = this.series.length - 1, j, i;
if (CONF.MIDDLE_WARE.display_filter_param) {
for (i = 0; i < this.series.length; i++) {
if (encodeURIComponent(this.series[i].options.filter) === CONF.MIDDLE_WARE.display_filter_param) {
seriesIndex = i;
}
}
}
if (CONF.MIDDLE_WARE.selectedTypeDate == "30d" && CONF.MIDDLE_WARE.display_date) {
if (CONF.MIDDLE_WARE.db_date === "current") {
for (i = 0; i < this.series[seriesIndex].data.length; i++) {
if (this.series[seriesIndex].data[i]["x"] == CONF.MIDDLE_WARE.display_date_ts) {
this.series[seriesIndex].data[i].select();
return;
}
;
}
;
}
} else if (CONF.MIDDLE_WARE.selectedTypeDate != "30d") {
for (i = 0; i < this.series[0].data.length; i++) {
if (this.series[0].data[i]["x"] === CONF.MIDDLE_WARE.db_date) {
this.series[0].data[i].select();
return;
}
;
}
} else if (CONF.MIDDLE_WARE.display_date) {
this.series[seriesIndex].data[this.series[seriesIndex].data.length - 1].select();
}
var topLine, _this = this;
_.each(_this.series, function(item) {
if (item.options.id == 'keywordsTopLine') {
topLine = item;
}
});
if (topLine) {
_.map(topLine.points, function(item, i) {
var sum = 0;
_.each(_this.series, function(serie) {
if (item.options.id != 'keywordsTopLine') {
sum = sum + serie.points[i].y;
}
});
item.y = sum;
});
_this.series[topLine.index] = topLine;
}
_this.redraw();
}
}
},
title: {
text: null
},
plotOptions: {
series: {
marker: {
radius: 3,
lineWidth: 1,
lineColor: "#fff",
states: {
select: {
radius: 4,
lineWidth: 1,
fillColor: "#f7931e",
lineColor: "#fff"
}
}
},
states: {
select: {
color: "#f7931e",
borderColor: "#fff"
}
},
shadow: false
},
column: {
stacking: "normal",
pointWidth: (CONF.MIDDLE_WARE.selectedTypeDate == "30d") ? 10 : (CONF.MIDDLE_WARE.selectedTypeDate == "all") ? 5 : (CONF.MIDDLE_WARE.selectedTypeDate == "6m") ? 23 : 10,
events: {
legendItemClick: function() {
var topLine, _this = this;
_.each(_this.chart.series, function(item) {
if (item.options.id == 'keywordsTopLine') {
topLine = item;
}
});
if (topLine) {
_.map(topLine.points, function(item, i) {
if (_this.visible) {
item.y = item.y - _this.points[i].y;
} else {
item.y = item.y + _this.points[i].y;
}
});
_this.chart.series[topLine.index] = topLine;
}
},
click: function(event) {
var date = new Date(event.point.x), reportType, gaType;
switch (CONF.MIDDLE_WARE.selectedTypeLine.substr(0, 1)) {
case "O":
reportType = "by organic";
gaType = "organic";
break;
case "A":
reportType = "by adwords";
gaType = "paid";
break;
default:
reportType = "by shopping";
gaType = "shopping";
}
if (CONF.MIDDLE_WARE.user_with_product) {
if (event.point.series.options.filter) {
if (CONF.MIDDLE_WARE.selectedTypeDate !== "30d") {
document.location = CONF.MIDDLE_WARE.db_prefix + "/" + date.getUTCFullYear() + ("0" + (date.getUTCMonth() + 1)).slice(-2) + "/info/" + CONF.MIDDLE_WARE.domain_id + " (" + reportType + ")?filter=" + encodeURIComponent(event.point.series.options.filter);
} else {
document.location = CONF.MIDDLE_WARE.db_prefix + "/info/" + CONF.MIDDLE_WARE.domain_id + " (" + reportType + ")?date=" + date.getUTCFullYear() + ("0" + (date.getUTCMonth() + 1)).slice(-2) + ("0" + date.getUTCDate()).slice(-2) + "&filter=" + encodeURIComponent(event.point.series.options.filter);
}
}
} else {
document.location = "/limit/";
}
}
}
},
areaspline: {
fillColor: "rgba(204, 233, 253, 0.75)",
fillOpacity: 0.5,
events: {
click: function(event) {
return clickOnChart(event);
}
}
},
spline: {
events: {
click: function(event) {
return clickOnChart(event);
}
}
}
},
xAxis: {
type: "datetime",
gridLineWidth: 0,
gridLineColor: "#e0e0e0",
labels: {
formatter: function() {
if (CONF.MIDDLE_WARE.selectedTypeDate == "30d")
return Highcharts.dateFormat("%e %b", this.value);
else
return Highcharts.dateFormat("%b'%y", this.value);
},
y: 20,
style: {
fontSize: 11,
color: '#999999'
}
},
minTickInterval: (function() {
if (CONF.MIDDLE_WARE.selectedTypeDate == "30d")
return 4 * 24 * 3600 * 1000;
else
return 31 * 24 * 3600 * 1000;
}
)(),
tickWidth: 0
},
yAxis: {
min: 0,
gridLineWidth: 1,
gridLineColor: "#ccc",
title: {
text: null
},
labels: {
style: {
fontSize: 11,
color: '#999999'
},
formatter: function() {
var i = parseInt(this.value, 10);
if (isNaN(i))
return 0;
if (i < 1000)
return i;
else if (i < 1000000)
return (i / 1000).toFixed(1) + 'K';
else if (i < 1000000000)
return (i / 1000000).toFixed(1) + 'M';
else
return (i / 1000000000).toFixed(1) + 'B';
}
},
showFirstLabel: false,
minRange: 1,
minTickInterval: 1
},
tooltip: {
shared: true,
useHTML: true,
hideDelay: 100,
snap: 0,
style: {
padding: '10px',
fontSize: '12px',
fontFamily: 'Ubuntu'
},
formatter: function() {
var dateFormat = (CONF.MIDDLE_WARE.selectedTypeDate == "30d") ? "%e %b %Y" : "%b %Y";
_.remove(this.points, function(point) {
return point.series.options.id === 'keywordsTopLine';
});
return _.template(TOOLTIP_TEMPLATE)({
title: Highcharts.dateFormat(dateFormat, this.x),
data: this.points,
show_positions: (CONF.MIDDLE_WARE.selectedTypeLine == 'Or' || CONF.MIDDLE_WARE.selectedTypeLine == 'Ad'),
LOCALE: CONF.LOCALE
});
}
},
legend: {
enabled: true,
borderWidth: 0,
symbolHeight: 15,
symbolWidth: 15,
symbolRadius: 1
}
},
getData: function(backendReports) {
var data, dataVs, ret = [], backendModel, backendModelD, backendModelR, selectedTypeLine = this.selectedTypeLine, selectedVsTypeLine = this.selectedVsTypeLine, selectedTypeDate = this.selectedTypeDate, color, colorVs;
_.each(backendReports.toJSON(), function(model) {
if (model.type === "domain_rank" && typeof model.responce.attributes !== "undefined") {
backendModelR = model;
}
if (model.type === "domain_rank_history" && typeof model.responce.attributes !== "undefined") {
if (typeof model.display_daily == "undefined") {
backendModel = model;
} else {
backendModelD = model;
}
}
});
if ((CONF.MIDDLE_WARE.selectedTypeDate != "30d" && typeof backendModel !== "undefined" && typeof backendModelR !== "undefined") || (CONF.MIDDLE_WARE.selectedTypeDate == "30d" && typeof backendModelD !== "undefined" && backendModelD.length)) {
if (CONF.MIDDLE_WARE.selectedTypeDate != "30d" && backendModelR.length) {
if (backendModel.length && parseInt(backendModel.last().get("Dt")) < parseInt(CONF.MIDDLE_WARE.last_update_date)) {
backendModel.push(backendModelR.first());
}
}
if (selectedTypeDate == "30d") {
data = prepareDataLine(backendModelD, selectedTypeLine, selectedTypeDate);
dataVs = prepareDataLine(backendModelD, selectedVsTypeLine, selectedTypeDate);
} else {
data = prepareDataLine(backendModel, selectedTypeLine, selectedTypeDate);
dataVs = prepareDataLine(backendModel, selectedVsTypeLine, selectedTypeDate);
}
if (CONF.MIDDLE_WARE.typeLine.length > 3) {
if (selectedTypeLine.substring(0, 1) == "O")
color = "#2D76B8";
else if (selectedTypeLine.substring(0, 1) == "A")
color = "#F7722A";
else
color = "#EC5397";
} else {
color = "#2D76B8";
}
if (selectedTypeLine && selectedTypeLine !== "Or" && selectedTypeLine !== "Ad") {
ret.push({
name: CONF.LOCALE[selectedTypeLine],
className: selectedTypeLine,
type: "spline",
data: _.map(data, function(arr) {
return [arr[0], arr[1]];
}),
index: 10,
color: color
});
}
if (typeof selectedVsTypeLine != "undefined" && selectedVsTypeLine) {
if (CONF.MIDDLE_WARE.typeLine.length > 3) {
if (selectedVsTypeLine.substring(0, 1) == "O")
colorVs = "#61A6DD";
else if (selectedVsTypeLine.substring(0, 1) == "A")
colorVs = "#F6A57A";
else
colorVs = "#F2A3D0";
} else {
colorVs = "#F7722A";
}
ret.push({
name: CONF.LOCALE[selectedVsTypeLine],
className: selectedVsTypeLine,
type: "spline",
data: _.map(dataVs, function(arr) {
return [arr[0], arr[1]];
}),
index: 10,
color: colorVs
});
} else if (!CONF.MIDDLE_WARE.show_positions || (selectedTypeLine !== "Or" && selectedTypeLine !== "Ad")) {
ret[0].type = "areaspline";
}
if (typeof selectedVsTypeLine == "undefined" && CONF.MIDDLE_WARE.show_positions && (selectedTypeLine == "Or" || selectedTypeLine == "Ad")) {
var groupCnt = (selectedTypeLine == "Or" && CONF.MIDDLE_WARE.keywords_positions == '100') ? 5 : 3;
var colors = ['250, 187, 50', '221, 237, 249', '178, 216, 240', '131, 181, 225', '121, 157, 193'];
for (var i = 1; i <= groupCnt; i++) {
var j = (selectedTypeLine == "Or" || selectedTypeLine == "Ad") ? i : i + 1;
ret.push({
name: CONF.LOCALE['keywords_group_' + i],
type: "column",
data: _.map(data, function(arr) {
return [arr[0], arr[j]];
}),
filter: CONF.MIDDLE_WARE['filter' + i],
reportType: CONF.MIDDLE_WARE['reportType' + i],
borderWidth: 1,
groupPadding: 0,
color: 'rgba(' + colors[i - 1] + ', 0.75)'
});
}
if (selectedTypeLine == "Or" || selectedTypeLine == "Ad") {
ret.push({
id: 'keywordsTopLine',
type: "spline",
name: CONF.LOCALE[selectedTypeLine],
className: selectedTypeLine,
data: _.map(data, function(arr) {
return [arr[0], 0];
}),
zIndex: 10
});
}
}
}
if (ret && ret[0] && ret[0].data.length) {
this.options.chartOptions.legend.enabled = (CONF.MIDDLE_WARE.show_positions && (CONF.MIDDLE_WARE.selectedTypeLine == "Or" || CONF.MIDDLE_WARE.selectedTypeLine == "Ad"));
return ret;
} else {
this.options.chartOptions.legend.enabled = false;
return [{}];
}
},
templates: {
header: function() {
var showSelector = false
, customSelector = false;
if (CONF.MIDDLE_WARE.typeLine.length) {
if (typeof this.selectedVsTypeLine != "undefined") {
if (CONF.MIDDLE_WARE.typeLine.length > 2) {
showSelector = true;
}
} else {
customSelector = (CONF.MIDDLE_WARE.typeLine.length <= 3);
if (CONF.MIDDLE_WARE.typeLine.length > 1) {
showSelector = true;
}
}
}
if (app.helper.isMobileDb(CONF.MIDDLE_WARE.current_db)) {
customSelector = false;
showSelector = false;
}
return _.template(HEADER_TEMPLATE)(_.extend(this.getTemplateData(), {
show_tabs: customSelector,
showSelector: showSelector,
selectedTypeLine: this.selectedTypeLine,
selectedVsTypeLine: this.selectedVsTypeLine,
selectedTypeDate: this.selectedTypeDate
}));
}
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
var CONF = this.CONF
, _this = this;
return new (app.ReportChart.extend({
initialize: function() {
this.selectedTypeLine = (typeof $("#typeLine", this.el).val() === "undefined" ? CONF.MIDDLE_WARE.selectedTypeLine : $("#typeLine", this.el).val());
this.selectedVsTypeLine = (typeof $("#vsTypeLine", this.el).val() === "undefined" ? CONF.MIDDLE_WARE.selectedVsTypeLine : $("#vsTypeLine", this.el).val());
this.selectedTypeDate = (typeof $("#typeDate a.pressed", this.el).attr("data-value") === "undefined" ? CONF.MIDDLE_WARE.selectedTypeDate : $("#typeDate a.pressed", this.el).attr("data-value"));
app.ReportChart.prototype.initialize.apply(this, arguments);
},
render: function() {
app.ReportChart.prototype.render.apply(this, arguments);
$('select', this.el).select2({
minimumResultsForSearch: -1,
width: "150px"
});
},
events: {
"change #typeLine": "_changePlot",
"click .typeLine a": "_changePlot",
"change #vsTypeLine": "_changePlot",
"click #typeDate a": "_changePlot",
"click .sem-widget-try-again": "tryAgainHandler"
},
_changePlot: function(e) {
if ($(e.target, this.el).is("#typeDate a")) {
$("#typeDate a", this.el).removeClass("pressed");
$(e.target, this.el).addClass("pressed");
}
if ($(e.target, this.el).is(".typeLine a")) {
$(".typeLine a", this.el).removeClass("pressed");
$(e.target, this.el).addClass("pressed");
$("#typeLine", this.el).val($(e.target, this.el).attr("data-value"));
}
this.selectedTypeLine = CONF.MIDDLE_WARE.selectedTypeLine = $("#typeLine", this.el).val();
this.selectedVsTypeLine = CONF.MIDDLE_WARE.selectedVsTypeLine = $("#vsTypeLine", this.el).val();
this.selectedTypeDate = CONF.MIDDLE_WARE.selectedTypeDate = $("#typeDate a.pressed", this.el).attr("data-value");
cookiesUtils.setCookie('do-chart-date', this.selectedTypeDate, 365);
if (CONF.MIDDLE_WARE.selectedTypeDate == "30d")
this.options.chartOptions.xAxis.minTickInterval = 4 * 24 * 3600 * 1000;
else
this.options.chartOptions.xAxis.minTickInterval = 31 * 24 * 3600 * 1000;
if (CONF.MIDDLE_WARE.show_positions) {
this.options.chartOptions.plotOptions.column.pointWidth = (CONF.MIDDLE_WARE.selectedTypeDate == "30d") ? 10 : (CONF.MIDDLE_WARE.selectedTypeDate == "all") ? 5 : (CONF.MIDDLE_WARE.selectedTypeDate == "6m") ? 23 : 10;
}
this.render();
this._updatePdf();
},
_updatePdf: function() {
var data = {
chart_type: this.selectedTypeLine,
period: this.selectedTypeDate
};
if (window.updatePdfParameters) {
window.updatePdfParameters(data);
}
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "<%= title %>
\n\n<% if (show_positions && _.first(data)) { %>\n\t<%= LOCALE.positions %>: <%= app.numberFormat((_.first(data)).total, 0, '.', ',') %>
\n<% } %>\n\n<% if (data.length) { %>\n\t\n\t\t<% _.each(data, function (item) { %>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\"> \n\t\t\t\t\t<%= item.point.series.name %>\n\t\t\t\t \n\t\t\t\t<%= app.numberFormat(item.point.y, 0, \".\", \",\") %> \n\t\t\t \n\t\t<% }); %>\n\t
\n<% } %>"
}
, function(module, exports) {
module.exports = "<%\n// show_tabs - show switcher between different widgets\n// selectedTypeLine - selected widget (Ot, Or, Ad)\n// showSelector - show select like 'organic vs paid' (probably used in old design)\n// selectedVsTypeLine - used in selector\n%>\n\n<% if (show_tabs) { %>\n\t\n\t \" id=\"typeLine\" />\n<% } else { %>\n\t<%\n\t// show select like 'organic vs paid', probably used in old design\n\t// hidden select is used in shopping\n\t%>\n\t\n<% } %>\n\n<% if (LOCALE.title) { %>\n\t\n<% } %>\n\n"
}
, , , , , , , , , , , , , , , , , , , , , , function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(70), __webpack_require__(71), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4), __webpack_require__(20), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, TH_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function(type) {
return 'Top ' + (type === 'organic' ? 'organic' : 'paid') + ' keywords';
}
var sendGa = function(type, label) {
if (typeof ga === 'undefined')
return;
ga('send', 'event', 'Domain overview', getGaWidgetName(type), label);
}
var gaClickOnTitle = function(type) {
sendGa(type, 'click to title')
}
var gaClickOnKeyword = function(type) {
sendGa(type, 'click to keyword')
}
var gaClickOnButton = function(type) {
sendGa(type, 'click to button')
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.title,
tooltip: CONF.LOCALE.title_tooltip,
title_href: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+" + CONF.MIDDLE_WARE.type + ")",
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
fullReportLink: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + CONF.MIDDLE_WARE.domain_id + '+(by+' + CONF.MIDDLE_WARE.type + ')',
needToLogNothingFound: true,
gaLabel: getGaWidgetName(CONF.MIDDLE_WARE.type) + ' - Overview',
reports: [{
back: (function() {
var foo = {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
action: "report",
responceAction: "overview_" + CONF.MIDDLE_WARE.type,
type: "domain_overview_" + CONF.MIDDLE_WARE.type,
display_sort: "tr_desc"
};
if (CONF.MIDDLE_WARE.exportHash) {
foo.display_hash = CONF.MIDDLE_WARE.exportHash;
}
if (CONF.MIDDLE_WARE.db_currency) {
foo.currency = CONF.MIDDLE_WARE.db_currency;
}
if (CONF.MIDDLE_WARE.api_display_date && CONF.MIDDLE_WARE.api_display_date !== 'current') {
foo.display_date = CONF.MIDDLE_WARE.api_display_date;
}
return foo;
}
)()
}],
overview: true,
templates: {
header: HEADER_TEMPLATE,
footer: FOOTER_TEMPLATE
},
labelClass: CONF.MIDDLE_WARE.labelClass,
labelText: CONF.MIDDLE_WARE.labelText,
table: {
itemsCount: 5,
header: function() {
var foo = [];
var trafficTitle = CONF.MIDDLE_WARE.is_new ? CONF.LOCALE.trafficPercent : CONF.LOCALE.traffic;
foo.push({
key: "Ph",
title: CONF.LOCALE.keyphrase_title
});
foo.push({
key: "Po",
title: CONF.LOCALE.pos,
className: "sem-report-block-table-col-40"
});
foo.push({
key: "Nq",
title: CONF.LOCALE.av_vol,
className: "sem-report-block-table-col-80"
});
if (CONF.MIDDLE_WARE.current_db !== "bing-us") {
foo.push({
key: "Cp",
title: CONF.LOCALE.cpc + ' (' + (CONF.MIDDLE_WARE.db_currency).toUpperCase() + ')',
className: "sem-report-block-table-col-80"
});
}
foo.push({
key: 'Tr',
title: trafficTitle,
className: "sem-report-block-table-col-80"
});
return foo;
},
templates: {
th: TH_TEMPLATE,
tr: TR_TEMPLATE
}
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
var CONF = this.CONF;
return new (app.ReportTable.extend({
nothingFoundEl: ".sem-widget-content",
events: {
'click .sem-widget-header-title a': function(e) {
gaClickOnTitle(CONF.MIDDLE_WARE.type);
},
'click .sem-report-block-full-report': function(e) {
gaClickOnButton(CONF.MIDDLE_WARE.type);
},
'click .cl-table-cell_keyword a': function(e) {
gaClickOnKeyword(CONF.MIDDLE_WARE.type);
},
'click .sem-widget-try-again': 'tryAgainHandler'
},
afterRender: function() {
app.ReportTable.prototype.afterRender.apply(this, arguments);
$(CONF.EL + " tr").tipsy({
title: "title",
gravity: "w"
});
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "<% var isNew = MIDDLE_WARE.is_new; %>\n\n<% if (countTr < options.table.itemsCount) { %>\n\t<% if (isNew) { %>\n\t\t\n\t<% } else { %>\n\t\t <%= item.get(\"Tr\") %>%\">\n\t<% } %>\n\t\t<%= helper.dispKw(item.get(\"Ph\"), 0) %>\n\t\t<%= helper.dispKwPos(item.get(\"Po\"), item.get(\"Pp\")) %>\n\t\t<%= helper.breakToThreeComa(item.get(\"Nq\")) %> \n\t\t<% if (MIDDLE_WARE.current_db !== \"bing-us\") { %>\n\t\t\t<%= helper.dispValue(item.get(\"Cp\")) %>\n\t\t<% } %>\n\n\t\t<% if (isNew) { %>\n\t\t\t<%= helper.dispValue(item.get(\"Tr\")) %>\n\t\t<% } else { %>\n\t\t\t<%= helper.dispTrBar(item.get(\"Tr\")) %>\n\t\t<% } %>\n\t \n<% } %>"
}
, function(module, exports) {
module.exports = ""
}
, function(module, exports) {
module.exports = "<% if (typeof options.fullReportLink !== \"undefined\") { %>\n\n<% } %>\n<% if (typeof options.exp !== \"undefined\") { %>\n\n<% } %>"
}
, , function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(75), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4), __webpack_require__(20), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function(type) {
return (type === 'organic_organic' ? 'Organic' : 'Paid') + ' competitor';
}
var gaClickOnTitle = function(type) {
sendGa(type, 'click to title');
}
var gaClickOnCompetitor = function(type) {
sendGa(type, 'click to competitor');
}
var gaClickOnComKeyword = function(type) {
sendGa(type, 'click to com. keywords');
}
var gaClickOnKeyword = function(type) {
sendGa(type, 'click to keywords');
}
var gaClickOnButton = function(type) {
sendGa(type, 'click to button');
}
var sendGa = function(type, label) {
var action = getGaWidgetName(type);
if (typeof ga !== 'undefined') {
ga('send', 'event', 'Domain overview', action, label);
}
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.title,
tooltip: CONF.LOCALE.title_tooltip,
title_href: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+" + CONF.MIDDLE_WARE.type + ")",
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
fullReportLink: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + CONF.MIDDLE_WARE.domain_id + '+(by+' + CONF.MIDDLE_WARE.type + ')',
needToLogNothingFound: true,
gaLabel: getGaWidgetName(CONF.MIDDLE_WARE.type) + ' - Overview',
reports: [{
back: (function() {
var foo = {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
action: "report",
responceAction: "overview_" + CONF.MIDDLE_WARE.type,
type: "domain_overview_" + CONF.MIDDLE_WARE.type,
display_sort: "tr_desc"
};
if (CONF.MIDDLE_WARE.exportHash) {
foo.display_hash = CONF.MIDDLE_WARE.exportHash;
}
if (CONF.MIDDLE_WARE.api_display_date && CONF.MIDDLE_WARE.api_display_date !== 'current') {
foo.display_date = CONF.MIDDLE_WARE.api_display_date;
}
return foo;
}
)()
}],
overview: true,
templates: {
header: HEADER_TEMPLATE,
footer: FOOTER_TEMPLATE
},
labelClass: CONF.MIDDLE_WARE.labelClass,
labelText: CONF.MIDDLE_WARE.labelText,
table: {
itemsCount: 5,
header: function() {
var foo = [];
foo.push({
key: "Dn",
title: CONF.LOCALE.domain
});
foo.push({
key: "Cr",
title: CONF.LOCALE.competitor_relevance,
className: "sem-report-block-table-col-100"
});
foo.push({
key: "Np",
title: CONF.LOCALE.common_keywords,
className: "sem-report-block-table-col-100"
});
foo.push({
key: "Or",
title: CONF.LOCALE.keywords,
className: "sem-report-block-table-col-80"
});
return foo;
},
templates: {
tr: TR_TEMPLATE
}
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
var CONF = this.CONF;
return new (app.ReportTable.extend({
nothingFoundEl: ".sem-widget-content",
afterRender: function() {
app.ReportTable.prototype.afterRender.apply(this, arguments);
$(CONF.EL + " tr").tipsy({
title: "title",
gravity: "w"
});
},
events: {
'click .sem-widget-header-title a': function(e) {
gaClickOnTitle(CONF.MIDDLE_WARE.type);
},
'click .sem-widget-table-first-col a': function(e) {
gaClickOnCompetitor(CONF.MIDDLE_WARE.type);
},
'click .cl-display-com-keyword a': function(e) {
gaClickOnComKeyword(CONF.MIDDLE_WARE.type);
},
'click .cl-display-keyword a': function(e) {
gaClickOnKeyword(CONF.MIDDLE_WARE.type);
},
'click .sem-report-block-full-report': function(e) {
gaClickOnButton(CONF.MIDDLE_WARE.type);
},
'click .sem-widget-try-again': 'tryAgainHandler'
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "<% var compRel = helper.getCompRelevance(item.get(\"Cr\"), 1);\nvar keywordsField = (MIDDLE_WARE.type == \"organic_organic\") ? 'Or' : 'Ad';\nvar reportType = (MIDDLE_WARE.type == \"organic_organic\") ? 'organic' : 'adwords';\nvar isNew = MIDDLE_WARE.is_new;\n%>\n\n<% if (countTr < options.table.itemsCount) { %>\n\t<% if (isNew) { %>\n\t\t%\">\n\t<% } else { %>\n\t\t %\">\n\t<% } %>\t\n\t<%= helper.dispDom(item.get(\"Dn\"), item.get(\"As\"), 1) %>\n\t<%\n\t\tif (isNew) {\n\t%>\n\t\t<%= helper.dispCRNew(item.get(\"Dn\"), item.get(\"Cr\"), 0, 1) %>\n\t<%\n\t\t} else {\n\t%>\t\n\t\t<%=\thelper.dispCR(item.get(\"Dn\"), item.get(\"Cr\"), 0, 1) %>\n\t<%\n\t\t}\n\t%>\n\t<%= helper.dispCKw(item.get(\"Dn\"), data.domain, item.get(\"Np\"), MIDDLE_WARE.type, null, '+|P0|Lt|21|+|P1|Lt|21') /* Common keywords */ %>\n\t\n\t<% if (parseInt(item.get(keywordsField), 10) > 0) { %>\n\t<%= helper.dispRoundNumWithA(item.get(keywordsField), app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + \"/info/\" + item.get(\"Dn\") + \"+(by+\" + reportType + \")\", 'cl-display-keyword') %>\n\t<% } else { %>\n\t<%= helper.dispRoundNum(item.get(keywordsField), 'cl-display-keyword') %>\n\t<% } %>\n \n<% } %>\n"
}
, , , function(module, exports) {
module.exports = "\n
<%= LOCALE.nothing_found %> \n"
}
, , function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(81), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function() {
return 'Top anchors'
}
var gaClickOnTitle = function() {
sendGa('click to title')
}
var gaClickOnButton = function() {
sendGa('click to button')
}
var gaClickOnExport = function() {
sendGa('click to export')
}
var sendGa = function(label) {
if (typeof ga === 'undefined')
return;
var action = getGaWidgetName();
ga('send', 'event', 'Domain overview', action, label);
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.table_title,
title_href: '/analytics/backlinks/anchors/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
fullReportLink: '/analytics/backlinks/anchors/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
needToLogNothingFound: true,
gaLabel: getGaWidgetName() + ' - Overview',
reports: [{
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
type: "backlinks_overview",
method: "nojsonp",
target: CONF.MIDDLE_WARE.target,
target_type: CONF.MIDDLE_WARE.target_type,
responceAction: "data",
display_hash: CONF.MIDDLE_WARE.display_hash,
export_columns: CONF.MIDDLE_WARE.export_columns
}
}],
overview: true,
table: {
header: (function() {
var columns = [];
columns.push({
title: CONF.LOCALE.anchors_title
}, {
title: CONF.LOCALE.domains_title,
className: 'sem-report-block-table-col-120'
}, {
title: CONF.LOCALE.backlinks_title,
className: 'sem-report-block-table-col-120'
});
return columns;
}
)(),
templates: {
tr: TR_TEMPLATE
}
},
templates: {
header: HEADER_TEMPLATE,
footer: FOOTER_TEMPLATE
},
exp: {
title: CONF.LOCALE["export"],
titlePrefix: CONF.LOCALE["export"],
link: CONF.MIDDLE_WARE.export_link,
limit: CONF.MIDDLE_WARE.limit
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
return new (app.ReportTable.extend({
getData: function(backendReports) {
var backendModel = _.values(backendReports.attributes)[0]
, col = new Backbone.Collection()
, response = backendModel.responce;
if (typeof response !== "undefined" && response.attributes) {
col.reset(response.attributes.anchors.data);
}
return col;
},
events: {
'click .sem-widget-header-title a': gaClickOnTitle,
'click .sem-report-block-full-report a': gaClickOnButton,
'click .sem-widget-export-link': gaClickOnExport,
'click .sem-widget-try-again': 'tryAgainHandler'
}
}))(this.reportConfig);
}
})
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "\n <%= helper.displayFormattedAnchor(helper.clipString4(item.attributes.anchor, 80), LOCALE.empty_anchor)%> \n\t<%= helper.breakToThreeComa(item.attributes.domains_num) %> \n\t<%= helper.breakToThreeComa(item.attributes.backlinks_num) %> \n \n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(4), __webpack_require__(86), __webpack_require__(87), __webpack_require__(91), __webpack_require__(94), __webpack_require__(83), __webpack_require__(45), __webpack_require__(96), __webpack_require__(97), __webpack_require__(99), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, Backbone, FixedMenu, SummaryClassic, SummaryBacklinks, SummaryEngagementMetrics, SummaryAdsense, OverviewLineChart, KeywordsChart, Categories, DATABASE_TEMPLATE) {
"use strict";
return Backbone.View.extend({
widgets: [],
totals: [],
other_databases: [],
initialize: function(options, reportConfig) {
this.CONF = options;
this._initSummarySections();
},
_initSummarySections: function() {
if (this.CONF.MIDDLE_WARE.current_db_date === 'current' && this.CONF.WIDGETS.Categories.MIDDLE_WARE.is_available) {
new Categories(this.CONF.WIDGETS.Categories);
}
this.summaryOrganic = new SummaryClassic(this.CONF.WIDGETS.SummaryOrganic);
this.summaryOrganic.report.on('summary:setNothingFound', this._setNothingFound, this);
this.summaryAdwords = new SummaryClassic(this.CONF.WIDGETS.SummaryAdwords);
this.summaryAdwords.report.on('summary:setNothingFound', this._setNothingFound, this);
this.summaryBacklinks = new SummaryBacklinks(this.CONF.WIDGETS.SummaryBacklinks);
this.summaryBacklinks.report.on('summary:setNothingFound', this._setNothingFound, this);
this.summaryEngagementMetrics = new SummaryEngagementMetrics(this.CONF.WIDGETS.SummaryEngagementMetrics);
this.summaryAdsense = new SummaryAdsense(this.CONF.WIDGETS.SummaryAdsense);
this.summaryAdsense.report.on('summary:setNothingFound', this._setNothingFound, this);
this.overviewLineChart = new OverviewLineChart(this.CONF.WIDGETS.OverviewLineChart);
this.organicKeywordsChart = new KeywordsChart(this.CONF.WIDGETS.OrganicKeywordsChart);
this.adwordsKeywordsChart = new KeywordsChart(this.CONF.WIDGETS.AdwordsKeywordsChart);
this.summaryOrganic.report.on('summary:otherDatabases', this._otherDatabases, this);
},
_setNothingFound: function(type, value) {
this.widgets[type] = value;
this._checkNothingFound();
},
_otherDatabases: function(databases) {
this.other_databases = databases;
},
_checkNothingFound: function() {
if (this.widgets['organic'] === false && this.widgets['adwords'] === false && this.widgets['adsense'] === false) {
if (typeof ga !== 'undefined') {
ga('send', 'event', 'Nothing found', 'all - Overview');
}
}
if (typeof this.widgets['organic'] != 'undefined' && typeof this.widgets['adwords'] != 'undefined' && typeof this.widgets['backlinks'] != 'undefined' && typeof this.widgets['adsense'] != 'undefined') {
if (this.widgets['organic'] === false && this.widgets['adwords'] === false && this.widgets['backlinks'] === false && this.widgets['adsense'] === false) {
$('#organic, #adwords, #backlinks, #asns, #videoadvertising, .summary').remove();
$('.summary-not-found-block').show();
this.summaryOrganic.report.logNothingFound(true, 'All blocks');
} else {
FixedMenu.showMenuOnScroll();
if (this.widgets['organic'] === false && this.widgets['adwords'] === false) {
if (this.widgets['backlinks'] === true || this.widgets['adsense'] === true) {
$('#charts').remove();
}
this._checkOtherDatabases();
}
if (this.widgets['backlinks'] === false) {
this.summaryOrganic.report.logNothingFound(true, 'Backlinks Block');
}
if (this.widgets['adsense'] === false) {
this.summaryAdsense.report.logNothingFound(true, 'Adsense Blocks');
}
if (this.widgets['organic'] === false) {
this.summaryOrganic.report.logNothingFound(true, 'Organic Block');
}
if (this.widgets['adwords'] === false) {
this.summaryAdwords.report.logNothingFound(true, 'Adwords Block');
}
}
}
},
_checkOtherDatabases: function() {
if (this.other_databases.length) {
var el = $('#databases');
el.html(_.template(DATABASE_TEMPLATE)({
databases: this.other_databases,
CONF: this.CONF
}));
$('.close-notification').click(function() {
el.hide();
});
}
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(84), __webpack_require__(85), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, FIXED_CONTENT_TEMPLATE, Backbone) {
"use strict";
var sendGaClickAds = function() {
sendClickGa('Ads');
}
var sendGaClickPublishers = function() {
sendClickGa('Publishers');
}
var sendGaClickAdvert = function() {
sendClickGa('Advertisers');
}
var sendClickGa = function(name) {
if (typeof ga === 'undefined')
return;
ga('send', 'event', 'Domain overview', 'Main metrics', 'click - Display advertising ' + name);
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var conf = this.conf = options;
this.reportConfig = {
el: $(conf.EL),
MIDDLE_WARE: conf.MIDDLE_WARE,
LOCALE: conf.LOCALE,
reports: function() {
var backs = [{
back: {
key: app.conf.KEY,
url: conf.MIDDLE_WARE.backend_url,
domain: conf.MIDDLE_WARE.domain_id,
type: "summary",
adsCount: 0
}
}];
return backs;
},
templates: {
header: "",
content: CONTENT_TEMPLATE,
widget: function() {
var ret = "";
ret += "";
if (this.noResults) {
ret += this.template("noResults");
} else if (this.serverError) {
ret += this.template("serverError");
} else {
ret += this.template("content");
}
return ret;
}
},
table: {
header: [],
footer: ''
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
app.deepExtend(this.options, this.reportConfig);
this.render();
},
render: function() {
var conf = this.conf;
this.report = new (app.ReportWidget.extend({
renderData: {
initialized: false
},
events: function() {
return _.extend({}, app.ReportWidget.prototype.events, {
"click .cl-metric-ads": sendGaClickAds,
"click .cl-metric-publishers": sendGaClickPublishers,
"click .cl-metric-advert": sendGaClickAdvert
});
},
showLoader: function() {
app.ReportWidget.prototype.showLoader.apply(this, arguments);
$('.asns, #asns .sem-report-block-title').show();
if ($('#asns .sem-widget-content').length) {
$('#asns .sem-widget-content .sem-widget-loader').show();
} else {
$('#asns').prepend('');
this.addSpinner($('#asns .sem-widget-loader'));
}
$('#asns .sem-report-block-error').hide();
},
hideLoader: function(e) {
app.ReportWidget.prototype.hideLoader.apply(this, arguments);
$('#asns .sem-widget-loader').hide();
if (this.serverError !== false || this.noResults) {
if (this.serverError === true) {
$('#asns .sem-report-block-error').html(conf.LOCALE.error_message).show();
} else {
$('#asns .sem-report-block-error').html(conf.LOCALE.timeout_message).show();
}
$('.asns').hide();
}
},
getData: function(backendReports) {
var backendModel;
var result = {
adsCount: 0,
advertisersCount: 0,
publishersCount: 0
};
_.each(backendReports.toJSON(), function(model) {
if (model.loaded) {
backendModel = model;
}
});
if (backendModel) {
var response = backendModel.responce;
result.adsCount = response.get("adsCount");
result.advertisersCount = response.get("advertisersCount");
result.publishersCount = response.get("publishersCount");
this.renderData.adsCount = response.get("adsCount");
this.renderData.hasData = response.get("hasData");
this.renderData.sharedData = response.get("rawData");
this.renderData.initialized = true;
}
return new Backbone.Collection([result]);
},
render: function() {
app.ReportWidget.prototype.render.apply(this, arguments);
var sharedData = this.renderData.sharedData;
if (this.renderData.initialized) {
$('.adsenseSummary').append(_.template(FIXED_CONTENT_TEMPLATE)(this.getTemplateData()));
if (this.renderData.hasData) {
requirejs(["page"], function(Page) {
var latestOptions = {
reports: [{
data: sharedData
}],
domainType: sharedData.latest.domainType
};
new Page.Publishers(conf.WIDGETS.Publishers,latestOptions);
var landingOptions = {
reports: [{
data: sharedData
}],
domainType: sharedData.landings.domainType
};
new Page.Landings(conf.WIDGETS.Landings,landingOptions);
if (sharedData.text.total > 0) {
var textOptions = {
reports: [{
data: sharedData
}],
domainType: sharedData.text.domainType
};
new Page.AdsenseAds(conf.WIDGETS.AdsenseTextAds,textOptions);
}
if (sharedData.media.total > 0) {
var mediaOptions = {
reports: [{
data: sharedData
}],
domainType: sharedData.media.domainType
};
new Page.AdsenseAds(conf.WIDGETS.AdsenseMediaAds,mediaOptions);
}
});
$('#asns .sem-report-block-nothing-found').hide();
$('.asns').css('visibility', 'visible');
$('.asns').show();
this.trigger('summary:setNothingFound', 'adsense', true);
} else {
$('.asns').hide();
$('#asns .sem-report-block-nothing-found').show();
this.trigger('summary:setNothingFound', 'adsense', false);
}
$('#asns .sem-widget-loader').hide();
}
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "<% if (typeof data !== \"undefined\" && data.length) {\nvar model = data.first();\n%>\n\n\n\t
\n\t
<%= LOCALE.ads_total_num_of_ads %>
\n
\n\n\n<% } %>\n"
}
, function(module, exports) {
module.exports = "<% if (typeof data !== \"undefined\" && data.length) {\nvar model = data.first();\n%>\n\n<% } %>\n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
'use strict';
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [],
__WEBPACK_AMD_DEFINE_RESULT__ = function() {
var overviewBlockSelect = function(id) {
var current = $(".sem-report-header-td.active").attr("data-id");
var $id = $("#" + id);
if ($id.length) {
var destination = $id.offset().top - $(".sem-report-header").outerHeight();
if (typeof current === "undefined") {
destination += 13;
}
$('body, html').animate({
scrollTop: destination
});
}
};
return {
allowScrollToBlocks: function() {
$('.sem-report-block-title-td').click(function() {
overviewBlockSelect($(this).attr('data-id'));
});
},
showMenuOnScroll: function() {
var resizeHeader = function(el) {
var left = $(document).scrollLeft();
el.css({
width: ($(".sem-report").width() + 60)
});
var $sideMenu = $(".sem-sidemenu");
el.css({
left: ($sideMenu.length > 0) ? ($sideMenu.width() - left + 30) : ($(".js-left-menu").width() - left + 30)
});
};
var nav = $(".sem-report-header");
$(".sem-report-header-start").waypoint({
handler: function(event, direction) {
if (direction === 'down') {
nav.addClass("fixed");
resizeHeader(nav);
} else {
nav.removeClass("fixed").css({
left: 0
})
}
},
offset: function() {
return nav.outerHeight();
}
});
$(".sem-o-footer-wrapper").waypoint({
handler: function(event, direction) {
if (direction === 'down') {
nav.removeClass("fixed").css({
left: 0
})
} else {
nav.addClass("fixed");
resizeHeader(nav);
}
},
offset: function() {
return -1 * nav.outerHeight();
}
});
var sections = $(".sem-report-block:visible");
var navigation_links = $(".sem-report-header-td");
sections.waypoint({
handler: function(event, direction) {
var active_section;
active_section = $(this);
if (direction === "up")
active_section = active_section.prev();
var active_link = $('.sem-report-header-td[data-id="' + active_section.attr("id") + '"]');
navigation_links.removeClass("active");
active_link.addClass("active");
},
offset: 175
});
navigation_links.click(function(event) {
overviewBlockSelect($(this).attr('data-id'));
});
this.allowScrollToBlocks();
$(window).resize(function() {
resizeHeader($(".sem-report-header.fixed"));
});
$(window).scroll(function() {
resizeHeader($(".sem-report-header.fixed"));
});
}
}
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(88), __webpack_require__(89), __webpack_require__(90), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, FIXED_CONTENT_TEMPLATE, NOTHING_FOUND_TEMPLATE, Backbone) {
"use strict";
var sendGaClickTraffic = function(type) {
sendClickGa(type, 'Traffic');
};
var sendGaClickCost = function(type) {
sendClickGa(type, 'Cost');
};
var sendGaClickRank = function(type) {
sendClickGa(type, 'Rank');
};
var sendGaClickKeywords = function(type) {
sendClickGa(type, 'Keywords');
};
var sendClickGa = function(type, name) {
if (typeof ga === 'undefined')
return;
var typeName = (type === 'organic' ? 'Organic' : 'Paid');
ga('send', 'event', 'Domain overview', 'Main metrics', 'click - ' + typeName + ' ' + name);
};
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
typeToLog: "domain_rank_history",
reports: function() {
var backs = [{
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
display_hash: CONF.MIDDLE_WARE.exportHash,
currency: CONF.MIDDLE_WARE.db_currency,
action: "report",
type: "domain_rank",
responceAction: "rank"
}
}, {
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
display_hash: CONF.MIDDLE_WARE.exportHashH,
currency: CONF.MIDDLE_WARE.db_currency,
action: "report",
type: "domain_rank_history",
display_sort: 'dt_asc',
responceAction: "rank_history"
}
}, {
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.current_backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
display_hash: CONF.MIDDLE_WARE.exportHashRanks,
currency: CONF.MIDDLE_WARE.db_currency,
action: "report",
type: "domain_ranks",
responceAction: "ranks"
}
}];
if (CONF.MIDDLE_WARE.current_db_date !== 'current') {
backs[2].back.display_date = CONF.MIDDLE_WARE.current_db_date + '15';
} else {
backs.push({
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
display_hash: CONF.MIDDLE_WARE.exportHashH,
currency: CONF.MIDDLE_WARE.db_currency,
action: "report",
type: "domain_rank_history",
display_daily: 1,
display_sort: 'dt_asc',
responceAction: "rank_history"
}
});
}
if (CONF.MIDDLE_WARE.api_display_date && CONF.MIDDLE_WARE.api_display_date !== 'current') {
backs = backs.map(function(back) {
back.back.display_date = CONF.MIDDLE_WARE.api_display_date;
return back;
});
}
return backs;
},
templates: {
header: "",
content: CONTENT_TEMPLATE,
widget: function() {
var ret = "";
ret += "";
if (this.noResults) {
ret += this.template("noResults");
} else if (this.serverError) {
ret += this.template("serverError");
} else {
ret += this.template("content");
}
return ret;
}
},
table: {
header: [],
footer: ''
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
app.deepExtend(this.options, this.reportConfig);
this.render();
},
render: function() {
var CONF = this.CONF;
this.report = new (app.ReportWidget.extend({
totals: {
traffic: -1
},
showLoader: function() {
app.ReportWidget.prototype.showLoader.apply(this, arguments);
$('.' + this.options.MIDDLE_WARE.type + 'Top, .' + this.options.MIDDLE_WARE.type + 'Center, .' + this.options.MIDDLE_WARE.type + 'Bottom, #' + this.options.MIDDLE_WARE.type + ' .sem-report-block-title').show();
if ($('#' + this.options.MIDDLE_WARE.type + ' .sem-widget-content').length) {
$('#' + this.options.MIDDLE_WARE.type + ' .sem-widget-content .sem-widget-loader').show();
} else {
$('#' + this.options.MIDDLE_WARE.type).prepend('');
this.addSpinner($('#' + this.options.MIDDLE_WARE.type + ' .sem-widget-loader'));
}
$('#' + this.options.MIDDLE_WARE.type + ' .sem-report-block-error').hide();
},
hideLoader: function(e) {
app.ReportWidget.prototype.hideLoader.apply(this, arguments);
$('#' + CONF.MIDDLE_WARE.type + ' .sem-widget-loader').hide();
if (this.serverError !== false || this.noResults) {
if (this.serverError === true) {
$('#' + this.CONF.MIDDLE_WARE.type + ' .sem-report-block-error').html(this.CONF.LOCALE.error_message).show();
} else {
$('#' + this.CONF.MIDDLE_WARE.type + ' .sem-report-block-error').html(this.CONF.LOCALE.timeout_message).show();
}
$('.' + this.CONF.MIDDLE_WARE.type + 'Top, .' + this.CONF.MIDDLE_WARE.type + 'Center, .' + this.CONF.MIDDLE_WARE.type + 'Bottom').hide();
}
},
getData: function(backendReports) {
this.CONF = CONF;
var backendModel, backendModelH, backendModelHD, currentModel, models, lastMonth, col = new Backbone.Collection(), _this = this, trafficField, trafficPriceField, keywordsField, result = {
traffic: 0,
traffic_prev: 0,
traffic_diff: 0,
keywords: 0,
keywords_prev: 0,
keywords_diff: 0,
traffic_price: 0,
traffic_price_prev: 0,
traffic_price_diff: 0,
rank: 0
};
if (CONF.MIDDLE_WARE.type === "organic") {
trafficField = "Ot";
trafficPriceField = "Oc";
keywordsField = "Or";
} else {
trafficField = "At";
trafficPriceField = "Ac";
keywordsField = "Ad";
}
_.each(backendReports.toJSON(), function(model) {
if (model.type === "domain_rank" && typeof model.responce.attributes !== "undefined") {
backendModel = model;
_this.totals.traffic = 0;
} else if (model.type === "domain_rank_history" && typeof model.responce.attributes !== "undefined") {
if (model.display_daily === 1) {
backendModelHD = model;
} else {
backendModelH = model;
}
}
});
if (typeof backendModelH !== "undefined" && backendModelH.length) {
models = _.values(backendModelH.first())[0].models;
if (_this.CONF.MIDDLE_WARE.current_db_date == "current") {
var getLastDailyPoint = function(backendModelHD) {
if (typeof _.values(backendModelHD.first())[0] === 'undefined') {
return null;
}
var dailyModels = _.values(backendModelHD.first())[0].models;
return (_.last(dailyModels)).get('Dt');
}
var getLastDayOfPrMonth = function() {
var date = new Date();
date.setDate(0);
return app.dateFormat('%Y%m%d', date);
}
var lastDailyDate = getLastDailyPoint(backendModelHD);
if (lastDailyDate && getLastDayOfPrMonth() >= lastDailyDate && models.length > 1) {
lastMonth = models[models.length - 1];
var lastMonthDate = lastMonth.get('Dt');
var lastMonthTs = new Date(Date.parse(lastMonthDate.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1/$2/$3 12:00:00")));
var lastDateTs = new Date(Date.parse(lastDailyDate.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1/$2/$3 12:00:00")));
if (lastMonthTs.getMonth() === lastDateTs.getMonth()) {
lastMonth = models[models.length - 2];
} else {
lastMonth = models[models.length - 1];
}
} else {
lastMonth = models[models.length - 1];
var lastMonthDate = lastMonth.get('Dt');
}
} else {
_.each(models, function(model) {
if (model.get("Dt") < _this.CONF.MIDDLE_WARE.current_db_date) {
lastMonth = model;
}
});
}
if (lastMonth) {
result.traffic_prev = lastMonth.get(trafficField);
result.traffic_price_prev = lastMonth.get(trafficPriceField);
result.keywords_prev = lastMonth.get(keywordsField);
}
}
if (typeof backendModel !== "undefined" && backendModel.length) {
currentModel = undefined;
if (backendModel.first()) {
currentModel = backendModel.first();
result.rank = currentModel.get("Rk");
result.traffic = currentModel.get(trafficField);
result.traffic_price = currentModel.get(trafficPriceField);
result.keywords = currentModel.get(keywordsField);
_this.totals.traffic = parseInt(currentModel.get(keywordsField));
}
}
var calcDiff = function(current, previous) {
current = current || 0;
previous = previous || 0;
var diff = current - previous;
if (previous > 0) {
diff = Math.round(100 * diff / previous);
} else if (current > 0) {
diff = 100;
}
return diff;
};
result.traffic_diff = calcDiff(result.traffic, result.traffic_prev);
result.traffic_price_diff = calcDiff(result.traffic_price, result.traffic_price_prev);
result.keywords_diff = calcDiff(result.keywords, result.keywords_prev);
col.push(result);
return col;
},
render: function() {
app.ReportWidget.prototype.render.apply(this, arguments);
if (this.totals.traffic != -1) {
var CONF = this.CONF;
$('.' + CONF.MIDDLE_WARE.type + 'Summary').html(_.template(FIXED_CONTENT_TEMPLATE)(this.getTemplateData()));
if (CONF.MIDDLE_WARE.type == "organic") {
if (this.totals.traffic > 0) {
if (typeof CONF.WIDGETS != 'undefined') {
requirejs(["page"], function(Page) {
new Page.Keywords(CONF.WIDGETS.OrganicKeywords);
new Page.KeywordsDistribution(CONF.WIDGETS.OrganicKeywordsDistribution);
new Page.Competitors(CONF.WIDGETS.OrganicCompetitors);
new Page.CompetitorsDistribution(CONF.WIDGETS.OrganicCompetitorsDistribution);
if (CONF.MIDDLE_WARE.current_db_date === 'current') {
new Page.BrandedTrafficSummary(CONF.WIDGETS.BrandedTrafficSummary);
new Page.BrandedTrafficChart(CONF.WIDGETS.BrandedTrafficChart);
new Page.BrandedTrafficTrend(CONF.WIDGETS.BrandedTrafficTrend);
}
});
$('.organicCenter').css('visibility', 'visible');
}
} else {
$('.organicCenter').hide();
$('#organic .sem-report-block-nothing-found').show();
$('#' + CONF.MIDDLE_WARE.type + 'Summary').html(_.template(NOTHING_FOUND_TEMPLATE)(this.getTemplateData()));
this._gaSuggestionShown();
}
} else {
if (this.totals.traffic > 0) {
requirejs(["page"], function(Page) {
new Page.Keywords(CONF.WIDGETS.AdwordsKeywords);
new Page.KeywordsDistribution(CONF.WIDGETS.AdwordsKeywordsDistribution);
new Page.Competitors(CONF.WIDGETS.AdwordsCompetitors);
new Page.CompetitorsDistribution(CONF.WIDGETS.AdwordsCompetitorsDistribution);
new Page.Ads(CONF.WIDGETS.AdwordsAds);
});
$('.adwordsCenter').css('visibility', 'visible');
} else {
$('.adwordsCenter').hide();
$('#adwords .sem-report-block-nothing-found').show();
}
}
this.trigger('summary:setNothingFound', CONF.MIDDLE_WARE.type, (this.totals.traffic > 0));
if (this.totals.traffic === 0) {
this._checkOtherDatabases();
}
$('#' + CONF.MIDDLE_WARE.type + ' .sem-widget-loader').hide();
}
},
_checkOtherDatabases: function() {
var backendReports = this.backendReports, backendModel, other_databases = [], _this = this;
_.each(backendReports.toJSON(), function(model) {
if (model.type === "domain_ranks" && typeof model.responce.attributes !== "undefined") {
backendModel = model;
}
});
if (typeof backendModel !== "undefined" && backendModel.length) {
_.each(backendModel.models, function(model) {
if (model.get("Db") != _this.CONF.MIDDLE_WARE.current_db) {
other_databases.push({
name: model.get("Db"),
keywords: parseInt(model.get("Or"))
});
}
});
}
other_databases = _.sortBy(other_databases, function(db) {
return -1 * db.keywords;
});
this.trigger('summary:otherDatabases', _.map(other_databases, "name"), false);
},
events: function() {
return _.extend({}, app.ReportWidget.prototype.events, {
"click .suggestion-box a": "_gaGotoTracking",
"click .show-data-link": "toggleTrackingSuggestion",
"click .cl-metric-traffic": function() {
sendGaClickTraffic(this.CONF.MIDDLE_WARE.type);
},
"click .cl-metric-rank": function() {
sendGaClickRank(this.CONF.MIDDLE_WARE.type);
},
"click .cl-metric-keywords": function() {
sendGaClickKeywords(this.CONF.MIDDLE_WARE.type);
},
"click .cl-metric-cost": function() {
sendGaClickCost(this.CONF.MIDDLE_WARE.type);
}
});
},
toggleTrackingSuggestion: function(e) {
$(e.target).toggleClass('_opened');
var infoBlock = $(e.target).parent().find('.suggestion-box');
infoBlock.toggle();
this._gaExpandSuggestion();
},
_gaExpandSuggestion: function() {
if (typeof ga !== "undefined") {
ga('send', 'event', 'Suggestion', 'Expand suggestion', 'Goto tracking');
}
},
_gaGotoTracking: function(e) {
if (typeof ga !== "undefined") {
ga('send', 'event', 'Suggestion', 'Click on button', 'Goto tracking');
}
},
_gaSuggestionShown: function() {
if (typeof ga !== "undefined") {
ga('send', 'event', 'Suggestion', 'Suggestion shown', 'Goto tracking');
}
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "<%\tif (typeof data !== \"undefined\" && data.length) {\n\t\tvar model = data.first(), sign, cssClass;\n%>\n\t\n\t<%\tsign = model.get(\"traffic_diff\") > 0 ? \"+\" : \"\";\n\t\tcssClass = model.get(\"traffic_diff\") > 0 ? 'positive' : (model.get(\"traffic_diff\") == 0 ? \"\" : 'negative'); %>\n\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t
\n\t\t
<%= LOCALE.traffic %>
\n\t
\n\n\t\n<%\t} %>\n"
}
, function(module, exports) {
module.exports = "<%\tif (typeof data !== \"undefined\" && data.length) {\n\t\tvar model = data.first(), sign, cssClass;\n%>\n\t<%\tsign = model.get(\"traffic_diff\") > 0 ? \"+\" : \"\";\n\t\tcssClass = model.get(\"traffic_diff\") > 0 ? 'positive' : (model.get(\"traffic_diff\") == 0 ? \"\" : 'negative'); %>\n\t\t\n\t\t\n<%\t} %>"
}
, function(module, exports) {
module.exports = "\n\n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(92), __webpack_require__(93), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, FIXED_CONTENT_TEMPLATE, Backbone) {
"use strict";
var sendGaClickBacklinks = function() {
sendClickGa('Backlinks');
}
var sendGaClickDomains = function() {
sendClickGa('Domains');
}
var sendGaClickIp = function() {
sendClickGa('Ips');
}
var sendClickGa = function(name) {
if (typeof ga === 'undefined')
return;
ga('send', 'event', 'Domain overview', 'Main metrics', 'click - Backlinks ' + name);
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
reports: function() {
var backs = [{
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.bl_backend_url,
target: CONF.MIDDLE_WARE.link,
type: "backlinks_overview",
method: "nojsonp",
target_type: CONF.MIDDLE_WARE.target_type,
export_columns: CONF.MIDDLE_WARE.export_columns,
responceAction: "data"
}
}];
if (CONF.MIDDLE_WARE.exportHashB) {
backs[0].back.display_hash = CONF.MIDDLE_WARE.exportHashB;
}
return backs;
},
templates: {
header: "",
content: CONTENT_TEMPLATE,
widget: function() {
var ret = "";
ret += "";
if (this.noResults) {
ret += this.template("content");
} else if (this.serverError) {
ret += this.template("serverError");
} else {
ret += this.template("content");
}
return ret;
}
},
table: {
header: [],
footer: ''
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
app.deepExtend(this.options, this.reportConfig);
this.render();
},
render: function() {
var CONF = this.CONF;
this.report = new (app.ReportWidget.extend({
totals: {
backlinks: -1
},
events: function() {
return _.extend({}, app.ReportWidget.prototype.events, {
"click .cl-metric-backlinks": sendGaClickBacklinks,
"click .cl-metric-domains": sendGaClickDomains,
"click .cl-metric-ip": sendGaClickIp
});
},
showLoader: function() {
app.ReportWidget.prototype.showLoader.apply(this, arguments);
$('.backlinks, #backlinks .sem-report-block-title').show();
if ($('#backlinks .sem-widget-content').length) {
$('#backlinks .sem-widget-content .sem-widget-loader').show();
} else {
$('#backlinks').prepend('');
this.addSpinner($('#backlinks .sem-widget-loader'));
}
$('#backlinks .sem-report-block-error').hide();
},
hideLoader: function(e) {
app.ReportWidget.prototype.hideLoader.apply(this, arguments);
$('#backlinks .sem-widget-loader').hide();
if (this.serverError !== false || this.noResults) {
if (this.serverError === true) {
$('#backlinks .sem-report-block-error').html(this.CONF.LOCALE.error_message).show();
} else {
$('#backlinks .sem-report-block-error').html(this.CONF.LOCALE.timeout_message).show();
}
$('.backlinks').hide();
}
},
getData: function(backendReports) {
this.CONF = CONF;
var backendModelB, col = new Backbone.Collection(), _this = this, result = {
backlinks: 0,
ref_domains: 0,
ref_ips: 0
};
_.each(backendReports.toJSON(), function(model) {
if (model.type === "backlinks_overview" && typeof model.responce.attributes !== "undefined") {
backendModelB = model;
_this.totals.backlinks = 0;
_this.totals.ref_domains = 0;
_this.totals.ref_ips = 0;
}
});
if (typeof backendModelB !== "undefined" && backendModelB.loaded) {
this.totals.backlinks = backendModelB.responce.attributes.total;
result.backlinks = backendModelB.responce.attributes.total;
result.ref_domains = backendModelB.responce.attributes.domains;
result.ref_ips = backendModelB.responce.attributes.ip;
}
col.push(result);
return col;
},
render: function() {
app.ReportWidget.prototype.render.apply(this, arguments);
if (this.totals.backlinks != -1) {
var CONF = this.CONF;
$('.backlinksSummary').append(_.template(FIXED_CONTENT_TEMPLATE)(this.getTemplateData()));
if (this.totals.backlinks > 0) {
requirejs(["page"], function(Page) {
new Page.Follow(CONF.WIDGETS.Follow);
new Page.BacklinksTypeChart(CONF.WIDGETS.BacklinksTypeChart);
new Page.Backlinks(CONF.WIDGETS.Backlinks);
new Page.BacklinksAnchors(CONF.WIDGETS.BacklinksAnchors);
new Page.BacklinksDomains(CONF.WIDGETS.BacklinksDomains);
new Page.BacklinksPages(CONF.WIDGETS.BacklinksPages);
});
$('.backlinks').css('visibility', 'visible');
this.trigger('summary:setNothingFound', 'backlinks', true);
} else {
$('.backlinks').hide();
$('#backlinks .sem-report-block-nothing-found').show();
this.trigger('summary:setNothingFound', 'backlinks', false);
}
if (CONF.WIDGETS.BacklinksDistribution) {
requirejs(["page"], function(Page) {
new Page.BacklinksDistribution(CONF.WIDGETS.BacklinksDistribution);
});
}
}
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "<%\tif (typeof data !== \"undefined\" && data.length) {\n\t\tvar model = data.first();\n%>\n\t\n\t\n\t\t
\n\t\t
<%= LOCALE.total %>
\n\t
\n\n\t\n<%\t} %>\n"
}
, function(module, exports) {
module.exports = "<%\tif (typeof data !== \"undefined\" && data.length) {\n\t\tvar model = data.first();\n%>\n\t\n<%\t} %>\n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(95), __webpack_require__(4)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, Backbone) {
"use strict";
return Backbone.View.extend({
initialize(options, reportConfig) {
this.reportConfig = {
el: $(options.EL),
MIDDLE_WARE: options.MIDDLE_WARE,
LOCALE: options.LOCALE,
reports: [{
back: {
url: options.MIDDLE_WARE.backend_url,
method: "nojsonp",
domain: options.MIDDLE_WARE.domain,
responceAction: "data"
}
}],
templates: {
header: "",
content: CONTENT_TEMPLATE,
widget: function() {
return this.template("content");
}
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
this.report = new (app.ReportWidget.extend({
getData: function(backendReports) {
var report = _.values(backendReports.attributes)[0];
var model = _.get(report, 'responce');
if (report.loaded) {
return model.toJSON();
}
return false;
},
render: function() {
const code = _.get(_.result(_.values(this.backendReports.toJSON())[0], 'responce.toJSON'), 'rawData.code');
if (code === 200) {
app.ReportWidget.prototype.render.apply(this, arguments);
}
}
}))(this.reportConfig);
}
})
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
}
, function(module, exports) {
module.exports = "\n\n\n\n\n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(39), __webpack_require__(78), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, HEADER_TEMPLATE, NOTHING_FOUND_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function(type) {
return (type === 'organic' ? 'Organic' : 'Paid') + ' Pie Сhart';
}
var gaClickOnPieChart = function(type, db) {
var label = 'click to piechart - ' + db;
if (typeof ga !== 'undefined') {
ga('send', 'event', 'Domain overview', getGaWidgetName(type), label);
}
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
CONF.LOW_VALUES_LIMIT = 2;
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.title,
tooltip: CONF.LOCALE.title_tooltip,
title_href: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+" + CONF.MIDDLE_WARE.type + ")",
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
needToLogNothingFound: true,
reports: [{
back: (function() {
var foo = {
key: app.conf.KEY,
domain: CONF.MIDDLE_WARE.domain_id,
url: CONF.MIDDLE_WARE.backend_url,
action: "report",
type: "domain_ranks",
responceAction: "rank"
};
if (CONF.MIDDLE_WARE.exportHash) {
foo.display_hash = CONF.MIDDLE_WARE.exportHash;
}
if (CONF.MIDDLE_WARE.current_db_date != 'current') {
foo.display_date = CONF.MIDDLE_WARE.current_db_date + '15';
}
if (CONF.MIDDLE_WARE.db_currency) {
foo.currency = CONF.MIDDLE_WARE.db_currency;
}
return foo;
}
)()
}],
chartOptions: {
chart: {
type: "pie",
spacingTop: 0,
spacingLeft: -80,
spacingRight: 0,
spacingBottom: 0,
height: 145
},
series: [{
size: '100%',
innerSize: '70%'
}],
legend: {
itemMarginBottom: 1,
verticalAlign: "top",
itemMarginTop: 3,
borderWidth: 0,
floating: true,
padding: 0,
layout: "vertical",
align: "center",
width: 40,
symbolWidth: 12,
symbolRadius: 2,
symbolPadding: 5,
y: 0,
x: 110,
itemStyle: {
fontSize: 10,
textTransform: "uppercase"
},
navigation: {
inactiveColor: "#ccc",
activeColor: "#3E576F",
animation: true,
arrowSize: 10,
style: {
fontWeight: "bold",
fontSize: "10px",
color: "#333"
}
}
},
plotOptions: {
pie: {
center: ['50%', '50%'],
ignoreHiddenPoint: true,
showInLegend: true,
slicedOffset: 0,
shadow: false,
size: "100%",
borderWidth: 0,
dataLabels: {
enabled: false
},
point: {
events: {
click: function(e) {
var sectionName = e.currentTarget.name;
if (sectionName != 'Other') {
gaClickOnPieChart(CONF.MIDDLE_WARE.type, sectionName);
window.location = "" + (sectionName == 'us' ? '' : '/' + sectionName) + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+" + CONF.MIDDLE_WARE.type + ")";
}
}
}
}
}
},
tooltip: {
formatter: function() {
return this.key + ": " + this.percentage.toFixed(2) + "%";
}
}
},
templates: {
header: HEADER_TEMPLATE
},
getData: function(backendReports) {
var ret = _.values(backendReports.toJSON());
var field = (CONF.MIDDLE_WARE.type == "organic" ? "Or" : "Ad");
var models = [];
if (typeof ret[0] != 'undefined') {
ret = ret[0];
if (CONF.MIDDLE_WARE.is_new_api) {
if (typeof ret.responce != 'undefined' && typeof ret.responce.attributes != 'undefined' && ret.responce.attributes.rawData != 'undefined' && ret.responce.attributes.rawData.rank != 'undefined' && ret.responce.attributes.rawData.rank.data != 'undefined') {
models = ret.responce.attributes.rawData.rank.data;
}
} else {
if (typeof ret != 'undefined' && typeof ret.models != 'undefined') {
models = ret.models;
}
}
}
if (CONF.MIDDLE_WARE.is_new_api) {
var sum = _.reduce(models, function(memo, item) {
if (typeof item !== "undefined" && typeof seDBdata[_.get(item, 'Db')] != 'undefined') {
return memo + parseInt(_.get(item, field), 10);
} else {
return memo;
}
}, 0)
, data = _.compact(_.map(models, function(item) {
if (typeof item !== "undefined" && parseInt(_.get(item, field), 10) && typeof seDBdata[_.get(item, 'Db')] != 'undefined') {
return [_.get(item, 'Db'), _.get(item, field) * 100 / sum];
}
}, this));
} else {
var sum = _.reduce(models, function(memo, item) {
if (typeof item !== "undefined" && typeof seDBdata[item.get('Db')] != 'undefined') {
return memo + parseInt(item.get(field), 10);
} else {
return memo;
}
}, 0)
, data = _.compact(_.map(models, function(item) {
if (typeof item !== "undefined" && parseInt(item.get(field), 10) && typeof seDBdata[item.get('Db')] != 'undefined') {
return [item.get('Db'), item.get(field) * 100 / sum];
}
}, this));
}
var merge = ["Other", 0];
if (data.length > 0) {
if (CONF.MIDDLE_WARE.mergeLowValues) {
_.each(data, function(item, key) {
if (item[1] < CONF.LOW_VALUES_LIMIT) {
merge[1] += item[1];
data[key] = "";
}
}, this);
}
data = _.compact(data);
data.sort(function(a, b) {
if (a[1] < b[1]) {
return 1;
}
if (a[1] > b[1]) {
return -1;
}
return 0;
});
if (merge[1]) {
data.push(merge);
}
data = [{
data: data,
type: "pie"
}];
} else {
this.el.html(_.template(NOTHING_FOUND_TEMPLATE)({
LOCALE: this.LOCALE
}));
return [{}];
}
return data;
},
labelClass: CONF.MIDDLE_WARE.labelClass,
labelText: CONF.MIDDLE_WARE.labelText
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
return new app.ReportChart(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(98), __webpack_require__(4)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, Backbone) {
"use strict";
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
className: 'widget-categories',
reports: [{
back: (function() {
var foo = {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
type: CONF.MIDDLE_WARE.type,
action: "report"
};
if (CONF.MIDDLE_WARE.type == "domain_rank") {
foo.domain = CONF.MIDDLE_WARE.domain_id;
foo.responceAction = "rank";
} else {
foo.phrase = CONF.MIDDLE_WARE.phrase;
foo.responceAction = "this";
}
return foo;
}
)()
}],
templates: {
content: CONTENT_TEMPLATE,
widget: function() {
var ret = "";
if (!this.noResults && !this.serverError) {
ret += this.template("content");
}
return ret;
}
},
getData: function(backendReports) {
var backendModel, result = {
categories: []
};
_.each(backendReports.toJSON(), function(model) {
backendModel = model;
});
if (typeof backendModel !== "undefined" && backendModel.length) {
backendModel = backendModel.first();
if (backendModel.get("Ca") && backendModel.get("Ca").length) {
_.each(backendModel.get("Ca").split(","), function(value) {
if (value) {
result.categories.push({
id: parseInt(value)
});
}
});
result.categories = _.compact(result.categories);
if (CONF.MIDDLE_WARE.type == "domain_rank") {
var distribution = (backendModel.get("Dc") && backendModel.get("Dc").length) ? backendModel.get("Dc").split(",") : [];
_.each(result.categories, function(model, i) {
result.categories[i].ratio = (typeof distribution[i] == "undefined") ? 0 : parseInt(distribution[i]);
});
}
if (CONF.MIDDLE_WARE.type == "domain_rank") {
var sum = _.reduce(_.map(result.categories, 'ratio'), function(total, n) {
return total + n;
});
result.other = {
ratio: (sum < 100) ? 100 - sum : '< 1'
};
}
}
}
return result;
}
};
this.render();
},
render: function() {
return new (app.ReportWidget.extend({
events: {
"click .report-title-categories-el": "categoryLineHandler",
"click .js-drop-category": "categoryDropdownHandler",
"hover .s-dropdown-btn": "openDetails"
},
categoryLineHandler: function(e) {
this.sendGa("Click on categories line");
},
categoryDropdownHandler: function(e) {
this.sendGa("Click on categories dropdown");
},
openDetails: function(e) {
this.sendGa("Open categories details");
},
sendGa: function(action) {
if (typeof ga !== "undefined") {
ga("send", "event", "DomainCategories", action);
}
}
}))(this.reportConfig);
}
})
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "<% if (typeof data !== \"undefined\" && data.categories.length) {\n\tvar positionsHref = (MIDDLE_WARE.type == \"domain_rank\") ? app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + \"/info/\" + MIDDLE_WARE.domain_id + \"+(by+organic)?filter=%2B|Ca|Eq|\" : \"\"; %>\n\n\t\n\t\t<%= LOCALE.category %>:\n\t\t<% _.each(_.take(data.categories, 3), function(category) { %>\n\t\t\t<<%= (MIDDLE_WARE.type == \"domain_rank\") ? \"a\" : \"span\" %><%= (positionsHref) ? \" href=\\\"\" + positionsHref + category.id + \"\\\"\" : \"\" %> class=\"s-link report-title-categories-el\">\n\t\t\t\t<%= LOCALE[\"domain_Ca_\" + category.id] %><%= (MIDDLE_WARE.type == \"domain_rank\") ? \"a\" : \"span\" %>>\n\t\t<% }); %>\n\n\t\t<% if (MIDDLE_WARE.type == \"domain_rank\") { %>\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t<%= LOCALE.show_ratio %>\n\t\t\t\t\t \n\t\t\t\t \n\t\t\t\t\n\t\t\t
\n\t\t<% } %>\n\t
\n<% } %>\n"
}
, function(module, exports) {
module.exports = ""
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, HEADER_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function(type) {
return (type === 'organic' ? 'Organic' : 'Paid') + ' position distribution';
}
var gaClickOnTitle = function(type) {
sendGa(type, 'click to title');
}
var gaClickOnRange = function(type) {
sendGa(type, 'click to range');
}
var sendGa = function(type, label) {
if (typeof ga !== 'undefined') {
ga('send', 'event', 'Domain overview', getGaWidgetName(type), label);
}
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.title,
tooltip: CONF.LOCALE.title_tooltip,
title_href: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+" + CONF.MIDDLE_WARE.type + ")",
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
needToLogNothingFound: true,
gaLabel: getGaWidgetName(CONF.MIDDLE_WARE.type) + ' - Overview',
reports: [{
back: (function() {
var foo = {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
action: "report",
type: "domain_rank",
responceAction: "rank"
};
if (CONF.MIDDLE_WARE.exportHash) {
foo.display_hash = CONF.MIDDLE_WARE.exportHash;
}
if (CONF.MIDDLE_WARE.db_currency) {
foo.currency = CONF.MIDDLE_WARE.db_currency;
}
if (CONF.MIDDLE_WARE.api_display_date && CONF.MIDDLE_WARE.api_display_date !== 'current') {
foo.display_date = CONF.MIDDLE_WARE.api_display_date;
}
return foo;
}
)()
}],
templates: {
header: HEADER_TEMPLATE
},
chartOptions: {
colors: ['rgba(188, 222, 247, 0.75)'],
chart: {
spacingTop: 10,
spacingLeft: -5,
spacingRight: 0,
spacingBottom: 10,
backgroundColor: CONF.MIDDLE_WARE.show_watermark ? null : '#fff',
type: 'column',
height: 222
},
title: {
text: null
},
plotOptions: {
column: {
pointPadding: 0,
events: {
click: function(event) {
gaClickOnRange(CONF.MIDDLE_WARE.type);
document.location = getLink(event.point.x);
}
}
},
series: {
shadow: false
}
},
xAxis: {
gridLineWidth: 0,
lineColor: '#cccccc',
labels: {
y: 20,
style: {
fontFamily: 'Ubuntu, Arial',
fontSize: 13,
color: '#999999'
}
},
tickWidth: 0,
categories: function() {
if (CONF.MIDDLE_WARE.keywords_positions == 100) {
return ['1-3', '4-10', '11-20', '21-30', '31-40', '41-50', '51-60', '61-70', '71-80', '81-90', '91-100'];
} else {
return [CONF.LOCALE.top_3, CONF.LOCALE.first_page, CONF.LOCALE.second_page];
}
}()
},
yAxis: {
min: 0,
minTickInterval: 1,
gridLineWidth: 0,
title: {
text: CONF.LOCALE.title_y,
x: 5,
style: {
fontSize: 12,
fontFamily: 'Ubuntu, Arial',
color: '#53a5e0'
}
},
showFirstLabel: false,
labels: {
x: 0,
style: {
fontSize: 12,
color: '#999999'
},
formatter: function() {
return (app.helper.roundNumRankNew(this.value) + '').toUpperCase();
}
}
},
tooltip: {
useHTML: true,
formatter: function() {
return CONF.LOCALE.clm_tooltip + ": " + "" + app.numberFormat(this.y, 0, ".", ",") + " ";
}
},
legend: {
enabled: false
}
},
getData: function(backendReports) {
var data = []
, postfixes = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a"];
if (CONF.MIDDLE_WARE.type == 'organic' && CONF.MIDDLE_WARE.keywords_positions == 20) {
postfixes = _.take(postfixes, 3);
}
var col = _.values(backendReports.attributes)[0];
var currentItem;
col.each(function(item) {
currentItem = item;
});
if (currentItem) {
if (CONF.MIDDLE_WARE.type === "organic") {
for (var j = 0; j < postfixes.length; j++) {
data.push({
y: parseInt(currentItem.get("X" + postfixes[j]))
});
}
} else {
var getPositionRange = function(top, btm) {
return _.reduce(postfixes.slice(top, btm), function(memo, item) {
return memo += parseInt(currentItem.get('Y' + item));
}, 0)
};
data.push({
y: getPositionRange(0, 3)
});
data.push({
y: getPositionRange(3, 8)
});
data.push({
y: getPositionRange(8, postfixes.length)
});
}
}
data = _.dropRightWhile(data, function(item) {
return !item.y
});
if (data.length) {
if (data.length < 3) {
for (var i = data.length; i < 3; i++) {
data.push({
y: 0
});
}
}
return [{
data: data
}];
}
return false;
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
var getLink = function(pointX) {
var filter;
switch (pointX) {
case 0:
filter = '+|Po|Lt|4';
break;
case 1:
filter = (CONF.MIDDLE_WARE.type == 'organic' ? '+|Po|Gt|3|+|Po|Lt|11' : '+|Po|Gt|3|+|Po|Lt|9');
break;
default:
if (CONF.MIDDLE_WARE.type == 'adwords') {
filter = '+|Po|Gt|8';
} else if (CONF.MIDDLE_WARE.keywords_positions == 100) {
filter = '+|Po|Gt|' + ((pointX - 1) * 10) + '|+|Po|Lt|' + (pointX * 10 + 1);
} else {
filter = '+|Po|Gt|10';
}
}
return app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + " (by " + CONF.MIDDLE_WARE.type + ")?filter=" + encodeURIComponent(filter);
};
return this.render();
},
render: function() {
var CONF = this.CONF
return new (app.ReportChart.extend({
events: {
"click .sem-widget-try-again": "tryAgainHandler",
'click .sem-widget-header-title a': function(e) {
gaClickOnTitle(CONF.MIDDLE_WARE.type);
}
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(102), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function() {
return 'Sample ads'
}
var gaClickOnTitle = function() {
sendGa('click to title')
}
var gaClickOnButton = function() {
sendGa('click to button')
}
var gaClickOnSample = function() {
sendGa('click to a sample')
}
var sendGa = function(label) {
if (typeof ga !== 'undefined') {
ga('send', 'event', 'Domain overview', getGaWidgetName(), label);
}
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.title,
tooltip: CONF.LOCALE.title_tooltip,
title_href: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+uniq_ads)",
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
fullReportLink: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + CONF.MIDDLE_WARE.domain_id + '+(by+uniq_ads)',
needToLogNothingFound: true,
gaLabel: getGaWidgetName() + ' - Overview',
reports: [{
back: (function() {
var foo = {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
display_hash: CONF.MIDDLE_WARE.exportHash,
action: "report",
type: "domain_overview_adwords",
responceAction: "overview_adwords",
display_sort: "tr_desc",
currency: CONF.MIDDLE_WARE.db_currency
};
if (CONF.MIDDLE_WARE.api_display_date && CONF.MIDDLE_WARE.api_display_date !== 'current') {
foo.display_date = CONF.MIDDLE_WARE.api_display_date;
}
return foo;
}
)()
}],
overview: true,
templates: {
header: HEADER_TEMPLATE,
footer: FOOTER_TEMPLATE
},
labelClass: CONF.MIDDLE_WARE.labelClass,
labelText: CONF.MIDDLE_WARE.labelText,
table: {
templates: {
data: function() {
return "<% if (typeof data !== \"undefined\" && data.length) { %>" + "" + "<% data.each(function(item, countTr) { %>" + "<% if (countTr < 4) { %>" + this.template("tr") + "<% } %>" + "<% if (countTr < 3) { %>" + "
" + "<% } %>" + "<% }); %>" + " " + "<% } else { %>" + "" + "colspan=\"<%= header.length %>\"<% } %> class=\"sem-widgets-no-results\"" + ">" + this.template("nothingFound") + " " + "<% } %>";
},
tr: TR_TEMPLATE,
th: ''
}
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
return new (app.ReportTable.extend({
nothingFoundEl: ".sem-widget-content",
events: {
'click .sem-widget-header-title a': gaClickOnTitle,
'click .sem-report-block-full-report a': gaClickOnButton,
'click .sem-widget-overview-info a': gaClickOnSample,
'click .sem-widget-try-again': 'tryAgainHandler'
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "\n\t\" target=\"_blank\"><%= item.get(\"Tt\").replace(/<\\/a>.+/i, \"\") %> \n\t<% if (item.get(\"Vu\")) { %>\n\t\">Ad <%= item.get(\"Vu\") %>
\n\t<% } %>\n\t<%= helper.replaceAdvDescription(item.get(\"Ds\")) %>
\n \n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(104), __webpack_require__(4)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, Backbone) {
"use strict";
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
reports: [{
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
type: "backlinks_overview",
method: "nojsonp",
target: CONF.MIDDLE_WARE.link,
target_type: CONF.MIDDLE_WARE.target_type,
responceAction: "data",
export_columns: CONF.MIDDLE_WARE.export_columns,
display_hash: CONF.MIDDLE_WARE.display_hash
}
}],
templates: {
header: "",
content: CONTENT_TEMPLATE,
widget: function() {
var header = this.template("header")
, footer = this.template("footer")
, ret = "";
if (header) {
ret += "";
}
ret += "";
if (this.noResults) {
ret += this.template("noResults");
} else if (this.serverError) {
ret += this.template("serverError");
} else {
ret += this.template("content");
}
if (footer) {
ret += "";
}
return ret;
}
},
table: {
header: [],
footer: ''
},
getData: function(backendReports) {
var foo = _.values(backendReports.attributes)[0]
, response = foo.responce;
if (foo.loaded) {
if (response.attributes.total == undefined) {
response.attributes.total = 0;
response.attributes.domains = 0;
response.attributes.ip = 0;
}
}
return response;
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
return new app.ReportWidget(this.reportConfig);
}
})
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "<% if (typeof data !== \"undefined\" && typeof data.attributes !== \"undefined\") { %>\n\t\n\t<%= LOCALE.total %>\n\t
\n\t\n\t<%= LOCALE.referring_domains %>\n\t
\n\t\n\t<%= LOCALE.referring_ips %>\n\t
\n<% } %>\n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(106), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, LEGEND_TEMPLATE, HEADER_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function() {
return 'Follow vs nofollow'
}
var gaClickToFollow = function() {
sendGa('click to follow')
}
var gaClickToNoFollow = function() {
sendGa('click to nofollow')
}
var sendGa = function(label) {
if (typeof ga === 'undefined')
return;
var action = getGaWidgetName();
ga('send', 'event', 'Domain overview', action, label);
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
var self = this;
this.reportConfig = {
el: $(CONF.EL),
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
needToLogNothingFound: true,
gaLabel: getGaWidgetName() + ' - Overview',
reports: [{
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
type: "backlinks_overview",
method: "nojsonp",
target: CONF.MIDDLE_WARE.link,
target_type: CONF.MIDDLE_WARE.target_type,
responceAction: "data",
display_hash: CONF.MIDDLE_WARE.display_hash,
export_columns: CONF.MIDDLE_WARE.export_columns
}
}],
chartOptions: {
chart: {
type: 'pie',
spacingTop: 0,
spacingLeft: 0,
spacingRight: 0,
spacingBottom: 0,
height: CONF.MIDDLE_WARE.height
},
legend: {
enabled: false
},
title: false,
plotOptions: {
pie: {
size: "100%",
shadow: false,
center: ['35%', '50%'],
dataLabels: {
enabled: false
},
startAngle: 90,
borderWidth: 0
}
},
series: [{
size: '100%',
innerSize: '80%',
point: {
events: {
click: function(e) {
if (e.target.point.index === 1) {
gaClickToFollow();
} else {
gaClickToNoFollow();
}
location.href = this.options.url;
}
}
}
}],
tooltip: {
snap: 2,
formatter: function() {
return this.y > 1 ? '' + this.point.name + ': ' + app.numberFormat(this.y, 2, ".", ",") + '%' : null;
}
}
},
templates: {
nothingFound: function() {
return "" + CONF.LOCALE.no_trend_data + "
";
},
header: "",
footer: "",
legend: LEGEND_TEMPLATE
},
getData: function(backendReports) {
var backendModel = _.values(backendReports.attributes)[0]
, result = []
, response = backendModel.responce;
if (typeof response !== "undefined" && response.attributes) {
if (response.attributes.total === 0)
return false;
result[0] = {
data: []
};
var follow = 0
, nofollow = 0
, followY = 100
, nofollowY = 0
, zeroData = true;
if (backendModel.loaded && response.attributes.follow != undefined) {
follow = response.attributes.follow;
nofollow = response.attributes.nofollow;
var sum = follow + nofollow;
if (sum != 0) {
zeroData = false;
followY = follow * 100 / sum;
nofollowY = 100 - followY;
}
}
var links = self.createFilterLinks()
result[0].data.push({
name: CONF.LOCALE.nofollow,
y: nofollowY,
color: app.HighChartsColors[1],
count: nofollow,
url: links.nofollow
}, {
name: CONF.LOCALE.dofollow,
y: followY,
color: app.HighChartsColors[0],
zeroData: zeroData,
count: follow,
url: links.follow
});
}
return result;
}
};
if (CONF.LOCALE.title) {
this.reportConfig.title = CONF.LOCALE.title;
this.reportConfig.title_href = '/analytics/backlinks/backlinks/' + encodeURIComponent(this.CONF.MIDDLE_WARE.link) + ':' + this.CONF.MIDDLE_WARE.target_type;
this.reportConfig.templates.header = HEADER_TEMPLATE;
}
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
createFilterLinks: function() {
var nofollowFilter = "+|type||nofollow"
, followFilter = "-|type||nofollow"
, currentLink = '/analytics/backlinks/backlinks/' + encodeURIComponent(this.CONF.MIDDLE_WARE.link) + ':' + this.CONF.MIDDLE_WARE.target_type;
return {
follow: currentLink + "?filter=" + encodeURIComponent(followFilter),
nofollow: currentLink + "?filter=" + encodeURIComponent(nofollowFilter)
};
},
render: function() {
return new (app.ReportChart.extend({
events: {
'click .backlinks-follow': gaClickToFollow,
'click .backlinks-nofollow': gaClickToNoFollow,
'click .sem-widget-try-again': 'tryAgainHandler'
},
afterRender: function() {
var data = this._getData();
if (data.length) {
var nofollowY = data[0].data[0].y
, angle = 90 - 180 * nofollowY / 100
, reportData = {
follow: 0,
nofollow: 0,
zeroData: data[0].data[1].zeroData
};
this.options.chartOptions.plotOptions.pie.startAngle = angle;
if (!reportData.zeroData) {
reportData.follow = data[0].data[1].count;
reportData.nofollow = data[0].data[0].count;
reportData.followLink = data[0].data[1].url;
reportData.nofollowLink = data[0].data[0].url;
}
var templateData = this.getTemplateData();
templateData.data = reportData;
$(this.el).append(_.template(this.template("legend"))(templateData));
}
app.ReportChart.prototype.afterRender.apply(this, arguments);
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "<% if (typeof data !== \"undefined\") { %>\n\n<% } %>\n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(108), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, LEGEND_TEMPLATE, HEADER_TEMPLATE, Backbone) {
"use strict";
var gaClickToChart = function(type) {
switch (type) {
case 0:
sendGa('click to frame links');
break;
case 1:
sendGa('click to form links');
break;
case 2:
sendGa('click to image links');
break;
case 3:
sendGa('click to text links');
break;
}
}
var sendGa = function(label) {
if (typeof ga === 'undefined')
return;
var action = 'Backlink type';
ga('send', 'event', 'Domain overview', action, label);
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
var self = this;
this.reportConfig = {
el: $(CONF.EL),
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
needToLogNothingFound: true,
reports: [{
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
type: "backlinks_overview",
method: "nojsonp",
target: CONF.MIDDLE_WARE.link,
target_type: CONF.MIDDLE_WARE.target_type,
responceAction: "data",
display_hash: CONF.MIDDLE_WARE.display_hash,
export_columns: CONF.MIDDLE_WARE.export_columns
}
}],
chartOptions: {
chart: {
type: 'pie',
spacingTop: 0,
spacingLeft: 0,
spacingRight: 0,
spacingBottom: 0,
height: CONF.MIDDLE_WARE.height
},
legend: {
enabled: false
},
title: false,
plotOptions: {
pie: {
size: "100%",
shadow: false,
center: ['35%', '50%'],
dataLabels: {
enabled: false
},
startAngle: 90,
borderWidth: 0
}
},
series: [{
size: '100%',
innerSize: '80%',
point: {
events: {
click: function(e) {
gaClickToChart(e.target.point.index);
location.href = this.options.url;
}
}
},
states: {
hover: {
enabled: true,
halo: false
}
}
}],
tooltip: {
snap: 2,
formatter: function() {
return '' + this.point.name + ': ' + app.numberFormat(this.point.yReal, 2, ".", ",") + '%';
}
}
},
templates: {
nothingFound: function() {
return '' + CONF.LOCALE.no_trend_data + '
';
},
header: '',
footer: '',
legend: LEGEND_TEMPLATE
},
getData: function(backendReports) {
var approxYsector = function(realY) {
if (realY > 2 || realY === 0)
return realY;
return (realY > 1) ? 2 : 1;
};
var backendModel = _.values(backendReports.attributes)[0]
, result = []
, response = backendModel.responce;
if (typeof response !== "undefined" && response.attributes) {
if (response.attributes.total === 0)
return false;
result[0] = {
data: []
};
var frame = 0
, frameY = 0
, frameYreal = 0
, form = 0
, formY = 0
, formYreal = 0
, image = 0
, imageY = 0
, imageYreal = 0
, text = 0
, textY = 100
, textYreal = 100
, total = 0
, zeroData = true;
if (backendModel.loaded && response.attributes.frame !== undefined) {
frame = response.attributes.frame;
form = response.attributes.form;
image = response.attributes.image;
total = response.attributes.total;
text = response.attributes.text || total - (form + frame + image);
if (total !== 0) {
zeroData = false;
frameYreal = frame * 100 / total;
formYreal = form * 100 / total;
imageYreal = image * 100 / total;
textYreal = 100 - (frameYreal + formYreal + imageYreal);
frameY = approxYsector(frameYreal);
formY = approxYsector(formYreal);
imageY = approxYsector(imageYreal);
textY = 100 - (frameY + formY + imageY);
}
}
var links = self.createFilterLinks();
result[0].data.push({
name: CONF.LOCALE.frame,
y: frameY,
yReal: frameYreal,
color: app.HighChartsColors[1],
count: frame,
url: links.frame
}, {
name: CONF.LOCALE.form,
y: formY,
yReal: formYreal,
color: app.HighChartsColors[2],
zeroData: zeroData,
count: form,
url: links.form
}, {
name: CONF.LOCALE.image,
y: imageY,
yReal: imageYreal,
color: app.HighChartsColors[3],
zeroData: zeroData,
count: image,
url: links.image
}, {
name: CONF.LOCALE.text,
y: textY,
yReal: textYreal,
color: app.HighChartsColors[0],
count: text,
url: links.text
});
}
return result;
}
};
if (CONF.LOCALE.title) {
this.reportConfig.title = CONF.LOCALE.title;
this.reportConfig.title_href = '/analytics/backlinks/backlinks/' + encodeURIComponent(this.CONF.MIDDLE_WARE.link) + ':' + this.CONF.MIDDLE_WARE.target_type;
this.reportConfig.templates.header = HEADER_TEMPLATE;
}
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
createFilterLinks: function() {
var frameFilter = "+|type||frame"
, formFilter = "+|type||form"
, imageFilter = "+|type||image"
, textFilter = "-|type||form|-|type||frame|-|type||image"
, currentLink = '/analytics/backlinks/backlinks/' + encodeURIComponent(this.CONF.MIDDLE_WARE.link) + ':' + this.CONF.MIDDLE_WARE.target_type;
return {
text: currentLink + "?filter=" + encodeURIComponent(textFilter),
frame: currentLink + "?filter=" + encodeURIComponent(frameFilter),
form: currentLink + "?filter=" + encodeURIComponent(formFilter),
image: currentLink + "?filter=" + encodeURIComponent(imageFilter)
};
},
render: function() {
return new (app.ReportChart.extend({
events: {
'click .legend-text': function() {
gaClickToChart(3)
},
'click .legend-frame': function() {
gaClickToChart(0)
},
'click .legend-form': function() {
gaClickToChart(1)
},
'click .legend-image': function() {
gaClickToChart(2)
},
'click .sem-widget-try-again': 'tryAgainHandler'
},
afterRender: function() {
var data = this._getData();
if (data.length) {
var frameY = data[0].data[0].y
, formY = data[0].data[1].y
, imageY = data[0].data[2].y
, angle = 90 - 180 * (frameY + formY + imageY) / 100
, reportData = {
text: 0,
frame: 0,
form: 0,
zeroData: data[0].data[1].zeroData
};
this.options.chartOptions.plotOptions.pie.startAngle = angle;
if (!reportData.zeroData) {
reportData.frame = data[0].data[0].count;
reportData.form = data[0].data[1].count;
reportData.image = data[0].data[2].count;
reportData.text = data[0].data[3].count;
reportData.frameLink = data[0].data[0].url;
reportData.formLink = data[0].data[1].url;
reportData.imageLink = data[0].data[2].url;
reportData.textLink = data[0].data[3].url;
}
var templateData = this.getTemplateData();
templateData.data = reportData;
$(this.el).append(_.template(this.template("legend"))(templateData));
}
app.ReportChart.prototype.afterRender.apply(this, arguments);
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "<% if (typeof data !== \"undefined\") { %>\n\n<% } %>\n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(110), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function() {
return 'Backlinks'
}
var gaClickOnTitle = function() {
sendGa('click to title')
}
var gaClickOnUrl = function() {
sendGa('click to url')
}
var gaClickOnButton = function() {
sendGa('click to button')
}
var gaClickOnExport = function() {
sendGa('click to export')
}
var sendGa = function(label) {
if (typeof ga !== 'undefined') {
ga('send', 'event', 'Domain overview', getGaWidgetName(), label);
}
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.table_title,
title_href: '/analytics/backlinks/backlinks/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
fullReportLink: '/analytics/backlinks/backlinks/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
needToLogNothingFound: true,
gaLabel: getGaWidgetName() + ' - Overview',
reports: [{
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
type: "backlinks_overview",
method: "nojsonp",
target: CONF.MIDDLE_WARE.target,
target_type: CONF.MIDDLE_WARE.target_type,
responceAction: "data",
display_hash: CONF.MIDDLE_WARE.display_hash,
export_columns: CONF.MIDDLE_WARE.export_columns
}
}],
overview: true,
table: {
header: (function() {
var columns = [];
columns.push({
title: CONF.LOCALE.backlink_title
}, {
title: CONF.LOCALE.backlink_anchor
}, {
title: CONF.LOCALE.backlink_type
});
return columns;
}
)(),
templates: {
tr: TR_TEMPLATE
}
},
templates: {
header: HEADER_TEMPLATE,
footer: FOOTER_TEMPLATE
},
exp: {
title: CONF.LOCALE["export"],
titlePrefix: CONF.LOCALE["export"],
link: CONF.MIDDLE_WARE.export_link,
limit: CONF.MIDDLE_WARE.limit
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
return new (app.ReportTable.extend({
getData: function(backendReports) {
var backendModel = _.values(backendReports.attributes)[0]
, col = new Backbone.Collection()
, response = backendModel.responce;
if (typeof response !== "undefined" && response.attributes) {
col.reset(response.attributes.backlinks.data);
}
return col;
},
events: {
'click .sem-widget-header-title a': gaClickOnTitle,
'click .sem-report-block-full-report a': gaClickOnButton,
'click .sem-widget-export-link': gaClickOnExport,
'click .backlinks-divlinks a': gaClickOnUrl,
'click .sem-widget-try-again': 'tryAgainHandler'
}
}))(this.reportConfig);
}
})
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "\n\t<%= helper.displayBacklinkLinkSource(item.attributes) %>\n\t<%= helper.displayBacklinkAnchorTarget(item.attributes) %>\n\t<%= helper.displayBacklinkType(item.attributes) %>\n \n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(112), __webpack_require__(72), __webpack_require__(39), __webpack_require__(113), __webpack_require__(15), __webpack_require__(4)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, topojson, countrieslib, Backbone) {
"use strict";
var getGaWidgetName = function() {
return 'Referring domains'
}
var gaClickOnTitle = function() {
sendGa('click to title')
}
var gaClickOnButton = function() {
sendGa('click to button')
}
var gaClickOnDomain = function() {
sendGa('click to domain')
}
var gaClickOnExport = function() {
sendGa('click to export')
}
var sendGa = function(label) {
if (typeof ga === 'undefined')
return;
var action = getGaWidgetName();
ga('send', 'event', 'Domain overview', action, label);
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
title: CONF.LOCALE.table_title,
title_href: '/analytics/backlinks/refdomains/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
fullReportLink: '/analytics/backlinks/refdomains/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
needToLogNothingFound: true,
gaLabel: getGaWidgetName() + ' - Overview',
reports: [{
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
type: "backlinks_overview",
method: "nojsonp",
responceAction: "data",
target: CONF.MIDDLE_WARE.target,
target_type: CONF.MIDDLE_WARE.target_type,
display_hash: CONF.MIDDLE_WARE.display_hash,
export_columns: CONF.MIDDLE_WARE.export_columns
}
}],
overview: true,
table: {
header: (function() {
var columns = [];
columns.push({
title: CONF.LOCALE.backlink_root_domain
}, {
title: CONF.LOCALE.backlink_backlinks_count,
className: "sem-report-block-table-col-80"
}, {
title: CONF.LOCALE.backlink_ip,
className: "sem-report-block-table-col-120"
});
return columns;
}
)(),
templates: {
tr: TR_TEMPLATE
}
},
templates: {
header: HEADER_TEMPLATE,
footer: FOOTER_TEMPLATE
},
exp: {
title: CONF.LOCALE["export"],
titlePrefix: CONF.LOCALE["export"],
link: CONF.MIDDLE_WARE.export_link,
limit: CONF.MIDDLE_WARE.limit
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
return new (app.ReportTable.extend({
getData: function(backendReports) {
var backendModel = _.values(backendReports.attributes)[0]
, col = new Backbone.Collection()
, response = backendModel.responce;
if (typeof response !== "undefined" && response.attributes) {
col.reset(response.attributes.refdomains.data);
}
return col;
},
events: {
'click .sem-widget-header-title a': gaClickOnTitle,
'click .sem-widget-content-table a': gaClickOnDomain,
'click .sem-report-block-full-report a': gaClickOnButton,
'click .sem-widget-export-link': gaClickOnExport,
'click .sem-widget-try-again': 'tryAgainHandler'
}
}))(this.reportConfig);
}
})
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "\n\t<%= helper.displayRefDomainLink(item.get(\"domain\")) %> \n\t<%= helper.breakToThreeComa(item.attributes.backlinks_num) %> \n\t<%= helper.displayCountryFlag(item.attributes.country) %> <%= item.attributes.ip %> \n \n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
!function() {
function e(e, n) {
function t(n) {
var t = e.arcs[n]
, r = t[0]
, o = [0, 0];
return t.forEach(function(e) {
o[0] += e[0],
o[1] += e[1]
}),
[r, o]
}
var r = {}
, o = {};
n.forEach(function(e) {
var n, a, i = t(e), u = i[0], c = i[1];
if (n = o[u])
if (delete o[n.end],
n.push(e),
n.end = c,
a = r[c]) {
delete r[a.start];
var f = a === n ? n : n.concat(a);
r[f.start = n.start] = o[f.end = a.end] = f
} else if (a = o[c]) {
delete r[a.start],
delete o[a.end];
var f = n.concat(a.map(function(e) {
return ~e
}).reverse());
r[f.start = n.start] = o[f.end = a.start] = f
} else
r[n.start] = o[n.end] = n;
else if (n = r[c])
if (delete r[n.start],
n.unshift(e),
n.start = u,
a = o[u]) {
delete o[a.end];
var s = a === n ? n : a.concat(n);
r[s.start = a.start] = o[s.end = n.end] = s
} else if (a = r[u]) {
delete r[a.start],
delete o[a.end];
var s = a.map(function(e) {
return ~e
}).reverse().concat(n);
r[s.start = a.end] = o[s.end = n.end] = s
} else
r[n.start] = o[n.end] = n;
else if (n = r[u])
if (delete r[n.start],
n.unshift(~e),
n.start = c,
a = o[c]) {
delete o[a.end];
var s = a === n ? n : a.concat(n);
r[s.start = a.start] = o[s.end = n.end] = s
} else if (a = r[c]) {
delete r[a.start],
delete o[a.end];
var s = a.map(function(e) {
return ~e
}).reverse().concat(n);
r[s.start = a.end] = o[s.end = n.end] = s
} else
r[n.start] = o[n.end] = n;
else if (n = o[c])
if (delete o[n.end],
n.push(~e),
n.end = u,
a = o[u]) {
delete r[a.start];
var f = a === n ? n : n.concat(a);
r[f.start = n.start] = o[f.end = a.end] = f
} else if (a = r[u]) {
delete r[a.start],
delete o[a.end];
var f = n.concat(a.map(function(e) {
return ~e
}).reverse());
r[f.start = n.start] = o[f.end = a.start] = f
} else
r[n.start] = o[n.end] = n;
else
n = [e],
r[n.start = u] = o[n.end = c] = n
});
var a = [];
for (var i in o)
a.push(o[i]);
return a
}
function n(n, t, r) {
function a(e) {
0 > e && (e = ~e),
(l[e] || (l[e] = [])).push(s)
}
function i(e) {
e.forEach(a)
}
function u(e) {
e.forEach(i)
}
function c(e) {
"GeometryCollection" === e.type ? e.geometries.forEach(c) : e.type in d && (s = e,
d[e.type](e.arcs))
}
var f = [];
if (arguments.length > 1) {
var s, l = [], d = {
LineString: i,
MultiLineString: u,
Polygon: u,
MultiPolygon: function(e) {
e.forEach(u)
}
};
c(t),
l.forEach(arguments.length < 3 ? function(e, n) {
f.push(n)
}
: function(e, n) {
r(e[0], e[e.length - 1]) && f.push(n)
}
)
} else
for (var p = 0, v = n.arcs.length; v > p; ++p)
f.push(p);
return o(n, {
type: "MultiLineString",
arcs: e(n, f)
})
}
function t(e, n) {
return "GeometryCollection" === n.type ? {
type: "FeatureCollection",
features: n.geometries.map(function(n) {
return r(e, n)
})
} : r(e, n)
}
function r(e, n) {
var t = {
type: "Feature",
id: n.id,
properties: n.properties || {},
geometry: o(e, n)
};
return null == n.id && delete t.id,
t
}
function o(e, n) {
function t(e, n) {
n.length && n.pop();
for (var t, r = s[0 > e ? ~e : e], o = 0, i = r.length; i > o; ++o)
n.push(t = r[o].slice()),
f(t, o);
0 > e && a(n, i)
}
function r(e) {
return e = e.slice(),
f(e, 0),
e
}
function o(e) {
for (var n = [], r = 0, o = e.length; o > r; ++r)
t(e[r], n);
return n.length < 2 && n.push(n[0].slice()),
n
}
function i(e) {
for (var n = o(e); n.length < 4; )
n.push(n[0].slice());
return n
}
function u(e) {
return e.map(i)
}
function c(e) {
var n = e.type;
return "GeometryCollection" === n ? {
type: n,
geometries: e.geometries.map(c)
} : n in l ? {
type: n,
coordinates: l[n](e)
} : null
}
var f = d(e.transform)
, s = e.arcs
, l = {
Point: function(e) {
return r(e.coordinates)
},
MultiPoint: function(e) {
return e.coordinates.map(r)
},
LineString: function(e) {
return o(e.arcs)
},
MultiLineString: function(e) {
return e.arcs.map(o)
},
Polygon: function(e) {
return u(e.arcs)
},
MultiPolygon: function(e) {
return e.arcs.map(u)
}
};
return c(n)
}
function a(e, n) {
for (var t, r = e.length, o = r - n; o < --r; )
t = e[o],
e[o++] = e[r],
e[r] = t
}
function i(e, n) {
for (var t = 0, r = e.length; r > t; ) {
var o = t + r >>> 1;
e[o] < n ? t = o + 1 : r = o
}
return t
}
function u(e) {
function n(e, n) {
e.forEach(function(e) {
0 > e && (e = ~e);
var t = o[e];
t ? t.push(n) : o[e] = [n]
})
}
function t(e, t) {
e.forEach(function(e) {
n(e, t)
})
}
function r(e, n) {
"GeometryCollection" === e.type ? e.geometries.forEach(function(e) {
r(e, n)
}) : e.type in u && u[e.type](e.arcs, n)
}
var o = {}
, a = e.map(function() {
return []
})
, u = {
LineString: n,
MultiLineString: t,
Polygon: t,
MultiPolygon: function(e, n) {
e.forEach(function(e) {
t(e, n)
})
}
};
e.forEach(r);
for (var c in o)
for (var f = o[c], s = f.length, l = 0; s > l; ++l)
for (var d = l + 1; s > d; ++d) {
var p, v = f[l], h = f[d];
(p = a[v])[c = i(p, h)] !== h && p.splice(c, 0, h),
(p = a[h])[c = i(p, v)] !== v && p.splice(c, 0, v)
}
return a
}
function c(e, n) {
function t(e) {
i.remove(e),
e[1][2] = n(e),
i.push(e)
}
var r, o = d(e.transform), a = p(e.transform), i = l(s), u = 0;
for (n || (n = f),
e.arcs.forEach(function(e) {
var t = [];
e.forEach(o);
for (var a = 1, u = e.length - 1; u > a; ++a)
r = e.slice(a - 1, a + 2),
r[1][2] = n(r),
t.push(r),
i.push(r);
e[0][2] = e[u][2] = 1 / 0;
for (var a = 0, u = t.length; u > a; ++a)
r = t[a],
r.previous = t[a - 1],
r.next = t[a + 1]
}); r = i.pop(); ) {
var c = r.previous
, v = r.next;
r[1][2] < u ? r[1][2] = u : u = r[1][2],
c && (c.next = v,
c[2] = r[2],
t(c)),
v && (v.previous = c,
v[0] = r[0],
t(v))
}
return e.arcs.forEach(function(e) {
e.forEach(a)
}),
e
}
function f(e) {
return Math.abs((e[0][0] - e[2][0]) * (e[1][1] - e[0][1]) - (e[0][0] - e[1][0]) * (e[2][1] - e[0][1]))
}
function s(e, n) {
return e[1][2] - n[1][2]
}
function l(e) {
function n(n) {
for (var t = o[n]; n > 0; ) {
var r = (n + 1 >> 1) - 1
, a = o[r];
if (e(t, a) >= 0)
break;
o[a.index = n] = a,
o[t.index = n = r] = t
}
}
function t(n) {
for (var t = o[n]; ; ) {
var r = n + 1 << 1
, a = r - 1
, i = n
, u = o[i];
if (a < o.length && e(o[a], u) < 0 && (u = o[i = a]),
r < o.length && e(o[r], u) < 0 && (u = o[i = r]),
i === n)
break;
o[u.index = n] = u,
o[t.index = n = i] = t
}
}
var r = {}
, o = [];
return r.push = function() {
for (var e = 0, t = arguments.length; t > e; ++e) {
var r = arguments[e];
n(r.index = o.push(r) - 1)
}
return o.length
}
,
r.pop = function() {
var e = o[0]
, n = o.pop();
return o.length && (o[n.index = 0] = n,
t(0)),
e
}
,
r.remove = function(r) {
var a = r.index
, i = o.pop();
return a !== o.length && (o[i.index = a] = i,
(e(i, r) < 0 ? n : t)(a)),
a
}
,
r
}
function d(e) {
if (!e)
return v;
var n, t, r = e.scale[0], o = e.scale[1], a = e.translate[0], i = e.translate[1];
return function(e, u) {
u || (n = t = 0),
e[0] = (n += e[0]) * r + a,
e[1] = (t += e[1]) * o + i
}
}
function p(e) {
if (!e)
return v;
var n, t, r = e.scale[0], o = e.scale[1], a = e.translate[0], i = e.translate[1];
return function(e, u) {
u || (n = t = 0);
var c = 0 | (e[0] - a) / r
, f = 0 | (e[1] - i) / o;
e[0] = c - n,
e[1] = f - t,
n = c,
t = f
}
}
function v() {}
var h = {
version: "1.4.6",
mesh: n,
feature: t,
neighbors: u,
presimplify: c
};
true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (h),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : "object" == typeof module && module.exports ? module.exports = h : this.topojson = h
}();
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(115), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function() {
return 'Indexed pages'
}
var gaClickOnTitle = function() {
sendGa('click to title')
}
var gaClickOnButton = function() {
sendGa('click to button')
}
var gaClickOnPage = function() {
sendGa('click to page')
}
var gaClickOnExport = function() {
sendGa('click to export')
}
var sendGa = function(label) {
if (typeof ga === 'undefined')
return;
var action = getGaWidgetName();
ga('send', 'event', 'Domain overview', action, label);
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
title: CONF.LOCALE.table_title,
title_href: '/analytics/backlinks/pages/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
fullReportLink: '/analytics/backlinks/pages/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
needToLogNothingFound: true,
gaLabel: getGaWidgetName() + ' - Overview',
reports: [{
back: (function() {
var foo = {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
type: "backlinks_overview",
method: "nojsonp",
responceAction: "data",
target: CONF.MIDDLE_WARE.target,
target_type: CONF.MIDDLE_WARE.target_type,
display_hash: CONF.MIDDLE_WARE.display_hash,
export_columns: CONF.MIDDLE_WARE.export_columns
};
return foo;
}
)()
}],
overview: true,
table: {
header: (function() {
var columns = [];
columns.push({
title: CONF.LOCALE.backlinks_pages_link
}, {
title: CONF.LOCALE.backlinks_pages_domains_count,
className: "sem-report-block-table-col-80"
}, {
title: CONF.LOCALE.backlink_backlinks_count,
className: "sem-report-block-table-col-80"
});
return columns;
}
)(),
templates: {
tr: TR_TEMPLATE
}
},
templates: {
header: HEADER_TEMPLATE,
footer: FOOTER_TEMPLATE
},
exp: {
title: CONF.LOCALE["export"],
titlePrefix: CONF.LOCALE["export"],
link: CONF.MIDDLE_WARE.export_link,
limit: CONF.MIDDLE_WARE.limit
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
return new (app.ReportTable.extend({
getData: function(backendReports) {
var backendModel = _.values(backendReports.attributes)[0]
, col = new Backbone.Collection()
, response = backendModel.responce;
if (typeof response !== "undefined" && response.attributes) {
col.reset(response.attributes.pages.data);
}
return col;
},
events: {
'click .sem-widget-header-title a': gaClickOnTitle,
'click .backlinks-divlinks a': gaClickOnPage,
'click .sem-report-block-full-report a': gaClickOnButton,
'click .sem-widget-export-link': gaClickOnExport,
'click .sem-widget-try-again': 'tryAgainHandler'
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "\n <%= helper.displayBacklinksPagesLink(item.attributes) %>\n \n\t\t\n\t\t<% if (item.attributes.source_url.length > 0 && item.attributes.domains_num > 0) { %>\n\t\t\t:url\">\n\t\t\t\t<%= helper.breakToThreeComa(item.attributes.domains_num) %>\n\t\t\t \n\t\t<% } else { %>\n\t\t\t<%= helper.breakToThreeComa(item.attributes.domains_num) %>\n\t\t<% } %>\n\t\t \n \n \n\t\t\n <% if (item.attributes.source_url.length > 0 && item.attributes.backlinks_num > 0 ) { %>\n\t :url\">\n\t <%= helper.breakToThreeComa(item.attributes.backlinks_num) %>\n\t \n <% } else { %>\n <%= helper.breakToThreeComa(item.attributes.backlinks_num) %>\n <% } %>\n\t\t \n \n \n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(117), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function() {
return 'Latest publishers'
}
var gaClickOnTitle = function() {
sendGa('click to title')
}
var gaClickOnExport = function() {
sendGa('click to export')
}
var gaClickOnUrl = function() {
sendGa('click to url')
}
var gaClickOnDomain = function() {
sendGa('click to domain')
}
var gaClickOnNumAds = function() {
sendGa('click to number of ads')
}
var gaClickOnPercentText = function() {
sendGa('click to percent of text')
}
var gaClickOnPercentImage = function() {
sendGa('click to percent of image')
}
var gaClickOnButton = function() {
sendGa('click to button')
}
var sendGa = function(label) {
if (typeof ga === 'undefined')
return;
var action = getGaWidgetName();
ga('send', 'event', 'Domain overview', action, label);
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
var isPublisher = reportConfig.domainType === "publisher";
var linkToSpa = (isPublisher) ? ("/analytics/da/advertisers/" + CONF.MIDDLE_WARE.domain_id) : ("/analytics/da/publishers/" + CONF.MIDDLE_WARE.domain_id);
this.reportConfig = {
el: $(CONF.EL),
title: isPublisher ? CONF.LOCALE.adv_title : CONF.LOCALE.pub_title,
tooltip: isPublisher ? CONF.LOCALE.adv_title : CONF.LOCALE.pub_title,
title_href: linkToSpa,
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
fullReportLink: linkToSpa,
needToLogNothingFound: true,
gaLabel: getGaWidgetName() + ' - Overview',
reports: [{
back: {
type: "latest"
}
}],
overview: true,
templates: {
header: HEADER_TEMPLATE,
footer: FOOTER_TEMPLATE
},
exp: {
title: CONF.LOCALE["export"],
titlePrefix: CONF.LOCALE["export"],
link: isPublisher ? CONF.MIDDLE_WARE.adv_link : CONF.MIDDLE_WARE.pub_link
},
table: {
header: [{
title: isPublisher ? CONF.LOCALE.adv_title : CONF.LOCALE.pub_title
}, {
title: CONF.LOCALE.ads_adverts_count_title,
className: "sem-report-block-table-col-40"
}, {
title: CONF.LOCALE.ads_textmedia,
className: "sem-widget-cell-to-center minimized"
}],
templates: {
tr: TR_TEMPLATE
}
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
return new (app.ReportTable.extend({
events: {
'click .sem-widget-header-title a': gaClickOnTitle,
'click .sem-report-block-full-report a': gaClickOnButton,
'click .sem-widget-export-link': gaClickOnExport,
'click .sem-widget-url-img': gaClickOnUrl,
'click .da-table-num-ads': gaClickOnNumAds,
'click .sem-asns-text-media-container .sem-asns-text-media-left a': gaClickOnPercentText,
'click .sem-asns-text-media-container .sem-asns-text-media-right a': gaClickOnPercentImage,
'click .sem-widget-url-cell': gaClickOnDomain,
'click .sem-widget-try-again': 'tryAgainHandler'
},
nothingFoundEl: ".sem-widget-content",
afterRender: function() {
app.ReportTable.prototype.afterRender.apply(this, arguments);
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "\n\t<%= helper.dispDom(item.get(\"domain\"), 0, 1) %>\n\t<%= helper.dispAdsColNumOfAds(MIDDLE_WARE.domain_id, item.get('domain'), item.get('adsCount'), item.get('textAdsCount'), item.get('mediaAdsCount'), LOCALE.ads_title_go_to_adv_pub_rep, LOCALE.ads_title_go_to_adv_pub_rep_text_ads, LOCALE.ads_title_go_to_adv_pub_rep_media_ads, \"\", \"sem-widget-cell-to-right\") %>\n\n\t\n\t\t<%=\n\t\thelper.adsTextmediaBar1(100,\n\t\t\tMIDDLE_WARE.domain_id,\n\t\t\titem.get('domain'),\n\t\t\t\"by+adsense_advertiser_publisher\",\n\t\t\titem.get('adsCount'),\n\t\t\titem.get('textAdsCount'),\n\t\t\titem.get('mediaAdsCount'),\n\t\t\tLOCALE.ads_title_go_to_adv_pub_rep_text_ads,\n\t\t\tLOCALE.ads_title_go_to_adv_pub_rep_media_ads\n\t\t) %>\n\t \n \n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(119), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function() {
return 'Landing pages'
}
var gaClickOnTitle = function() {
sendGa('click to title')
}
var gaClickOnUrl = function() {
sendGa('click to url')
}
var gaClickOnButton = function() {
sendGa('click to button')
}
var sendGa = function(label) {
if (typeof ga === 'undefined')
return;
ga('send', 'event', 'Domain overview', getGaWidgetName(), label);
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
var isPublisher = reportConfig.domainType === "publisher";
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.title,
tooltip: CONF.LOCALE.title_tooltip,
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
needToLogNothingFound: true,
gaLabel: getGaWidgetName() + ' - Overview',
reports: [{
back: {
type: "landings"
}
}],
overview: true,
templates: {
header: HEADER_TEMPLATE,
footer: FOOTER_TEMPLATE
},
table: {
header: [{
title: CONF.LOCALE.ads_landing_title
}, {
title: CONF.LOCALE.ads_times_seen_title,
className: "sem-report-block-table-col-40"
}],
templates: {
tr: TR_TEMPLATE
}
}
};
if (!isPublisher) {
this.reportConfig.title_href = "/analytics/da/landings/" + CONF.MIDDLE_WARE.domain_id;
this.reportConfig.fullReportLink = "/analytics/da/landings/" + CONF.MIDDLE_WARE.domain_id;
}
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
return new (app.ReportTable.extend({
nothingFoundEl: ".sem-widget-content",
events: {
'click .sem-widget-header-title a': gaClickOnTitle,
'click .sem-report-block-full-report a': gaClickOnButton,
'click .sem-widget-url-img': gaClickOnUrl,
'click .sem-widget-try-again': 'tryAgainHandler'
},
afterRender: function() {
app.ReportTable.prototype.afterRender.apply(this, arguments);
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "\n\t<%= helper.dispAdsLandings(item.get(\"targetUrl\")) %>\n\t<%= helper.breakToThreeComa(item.get(\"timesSeen\")) %> \n \n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(121), __webpack_require__(122), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, TEXT_TR_TEMPLATE, MEDIA_TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
"use strict";
var gaClickOnTitle = function(kind) {
sendGa(kind, 'click to title')
}
var gaClickOnExport = function(kind) {
sendGa(kind, 'click to export')
}
var gaClickOnSample = function(kind) {
if (kind === 'text') {
sendGa(kind, 'click to sample');
} else {
gaClickOnImage(kind);
}
}
var gaClickOnButton = function(kind) {
sendGa(kind, 'click to button')
}
var gaClickOnImage = function(kind) {
sendGa(kind, 'click to image')
}
var sendGa = function(kind, label) {
if (typeof ga === 'undefined')
return;
var action = kind == 'text' ? 'Sample text ads' : 'Sample image ads';
ga('send', 'event', 'Domain overview', action, label);
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
var isPublisher = reportConfig.domainType === "publisher";
var kind = (CONF.MIDDLE_WARE.ads_kind == 'text' ? '_textAds' : 'mediaAds');
var linkToSpa = "/analytics/da/creatives/" + CONF.MIDDLE_WARE.domain_id + "?detailedName=" + kind + '&platformName=' + (isPublisher ? 'asPublisher' : 'asAdvertiser');
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.title,
tooltip: CONF.LOCALE.title_tooltip,
title_href: linkToSpa,
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
fullReportLink: linkToSpa,
needToLogNothingFound: true,
reports: [{
back: {
type: CONF.MIDDLE_WARE.ads_kind
}
}],
exp: (CONF.MIDDLE_WARE.ads_kind == 'text') ? {
title: CONF.LOCALE["export"],
titlePrefix: CONF.LOCALE["export"],
link: isPublisher ? CONF.MIDDLE_WARE.adv_link : CONF.MIDDLE_WARE.pub_link
} : undefined,
templates: {
header: HEADER_TEMPLATE,
footer: FOOTER_TEMPLATE
},
table: {
templates: {
data: function() {
return "<% if (typeof data !== \"undefined\" && data.length) { %>" + "" + "<% data.each(function(item, countTr) { %>" + "<% if (countTr < 4) { %>" + this.template("tr") + "<% } %>" + "<% if (countTr < 3) { %>" + "
" + "<% } %>" + "<% }); %>" + " " + "<% } else { %>" + "" + "colspan=\"<%= header.length %>\"<% } %> class=\"sem-widgets-no-results\"" + ">" + this.template("nothingFound") + " " + "<% } %>";
},
tr: (CONF.MIDDLE_WARE.ads_kind == 'text') ? TEXT_TR_TEMPLATE : MEDIA_TR_TEMPLATE
}
},
reportLimit: 1,
overview: true,
getData: function(backendData) {
_.each(backendData.toJSON(), function(model) {
if (model.length != 0) {
var mds;
mds = model.models.slice(0, 4);
_.map(mds, function(i, index) {
i.set('spa_url', linkToSpa + '&item=' + index);
});
model.models = mds;
model.length = mds.length;
}
});
return app.ReportTable.prototype.getData.apply(this, arguments);
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
var CONF = this.CONF;
return new (app.ReportTable.extend({
events: {
'click .sem-widget-header-title a': function() {
gaClickOnTitle(CONF.MIDDLE_WARE.ads_kind)
},
'click .sem-report-block-full-report a': function() {
gaClickOnButton(CONF.MIDDLE_WARE.ads_kind)
},
'click .sem-widget-export-link': function() {
gaClickOnExport(CONF.MIDDLE_WARE.ads_kind)
},
'click .sem-widget-overview-info a': function() {
gaClickOnSample(CONF.MIDDLE_WARE.ads_kind)
},
'click .sem-widget-try-again': 'tryAgainHandler'
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "\n\t\n\t <%= item.get(\"title\").replace(/<\\/a>.+/i, \"\") %>\n\t \n\t<% if (item.get(\"visibleUrl\")) { %>\n\t\">Ad <%= item.get(\"visibleUrl\") %>
\n\t<% } %>\n\t<%= item.get(\"text\")%>
\n "
}
, function(module, exports) {
module.exports = "\n \n \"/>
\n \n "
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(39), __webpack_require__(78), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, HEADER_TEMPLATE, NOTHING_FOUND_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function() {
return 'Branded search'
}
var gaClickOnChart = function(type) {
sendGa('click to pie chart - ' + type);
}
var sendGa = function(label) {
var action = getGaWidgetName();
if (typeof ga !== 'undefined') {
ga('send', 'event', 'Domain overview', action, label);
}
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options
, _this = this;
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.title,
tooltip: CONF.LOCALE.title_tooltip,
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
needToLogNothingFound: true,
gaLabel: getGaWidgetName() + ' - Overview',
reports: [{
back: (function() {
var foo = {
key: app.conf.KEY,
domain: CONF.MIDDLE_WARE.domain_id,
url: CONF.MIDDLE_WARE.backend_url,
action: "report",
type: "domain_rank",
responceAction: "rank"
};
if (CONF.MIDDLE_WARE.exportHash) {
foo.display_hash = CONF.MIDDLE_WARE.exportHash;
}
if (CONF.MIDDLE_WARE.current_db_date != 'current') {
foo.display_date = CONF.MIDDLE_WARE.current_db_date + '15';
}
return foo;
}
)()
}],
chartOptions: {
chart: {
type: "pie",
spacingTop: 0,
spacingLeft: 0,
spacingRight: 0,
spacingBottom: 0,
height: 100
},
series: [{
size: '100%',
innerSize: '70%'
}],
legend: {
useHTML: true,
labelFormatter: function() {
return '' + this.percentage.toFixed(2) + '% ' + this.name + '
';
},
itemMarginBottom: 5,
verticalAlign: "top",
borderWidth: 0,
symbolWidth: 0,
floating: false,
padding: 0,
layout: "vertical",
align: "right",
margin: 0,
itemStyle: {
fontSize: '12px',
fontWeight: 'normal'
},
navigation: {
enabled: false
}
},
plotOptions: {
pie: {
center: ['50%', '50%'],
ignoreHiddenPoint: true,
showInLegend: true,
slicedOffset: 0,
shadow: false,
size: "100%",
borderWidth: 0,
dataLabels: {
enabled: false
},
point: {
events: {
click: function(e) {
e.preventDefault();
gaClickOnChart(this.index ? 'nonbranded' : 'branded');
_this._goToReport(this.index ? 0 : 1);
},
legendItemClick: function(e) {
e.preventDefault();
gaClickOnChart(this.index ? 'nonbranded' : 'branded');
_this._goToReport(this.index ? 0 : 1);
}
}
}
}
},
tooltip: {
formatter: function() {
return this.key + ": " + this.percentage.toFixed(2) + "%";
}
},
colors: ["#8bc835", "#0074ba"]
},
templates: {
header: HEADER_TEMPLATE,
nothingFound: NOTHING_FOUND_TEMPLATE
},
getData: function(backendReports) {
var ret = _.values(backendReports.toJSON())
, model = (typeof ret[0] != 'undefined' && typeof ret[0].models != 'undefined' && ret[0].models.length && typeof ret[0].models[0] != 'undefined') ? ret[0].models : [];
var data = [];
if (model.length > 0) {
var result = model[0]
, sum = result.get('Ot')
, traffic = {
branded: result.get('Td'),
not_branded: (result.get('Ot') - result.get('Td'))
};
if (sum > 0) {
data = _.map(traffic, function(item, type) {
if (typeof item !== "undefined" && !isNaN(item)) {
return [CONF.LOCALE['chart_value_' + type], item * 100 / sum];
} else {
return;
}
}, this);
}
}
if (data.length > 0) {
data = [{
data: data,
type: "pie"
}];
} else {
if (typeof ret[0].models != 'undefined' && ret[0].models.length) {
this.el.html(_.template(NOTHING_FOUND_TEMPLATE)({
LOCALE: CONF.LOCALE
}));
}
}
return data;
},
labelClass: CONF.MIDDLE_WARE.labelClass,
labelText: CONF.MIDDLE_WARE.labelText
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
_goToReport: function(type) {
window.location = app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + this.CONF.MIDDLE_WARE.domain_id + '+(by+organic)?filter=' + encodeURIComponent('+|Br|Eq|') + type;
},
render: function() {
return new app.ReportChart(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(39), __webpack_require__(78), __webpack_require__(125), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, HEADER_TEMPLATE, NOTHING_FOUND_TEMPLATE, CONTENT_TEMPLATE, Backbone) {
"use strict";
var getGaWidgetName = function() {
return 'Branded search'
}
var gaClickOnNumber = function() {
sendGa('click to number of kewords');
}
var sendGa = function(label) {
var action = getGaWidgetName();
if (typeof ga !== 'undefined') {
ga('send', 'event', 'Domain overview', action, label);
}
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.title,
tooltip: CONF.LOCALE.title_tooltip,
tooltip_position: 'right',
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
gaLabel: getGaWidgetName() + ' - Overview',
reports: [{
back: (function() {
var foo = {
key: app.conf.KEY,
domain: CONF.MIDDLE_WARE.domain_id,
url: CONF.MIDDLE_WARE.backend_url,
action: "report",
type: "domain_rank",
responceAction: "rank"
};
if (CONF.MIDDLE_WARE.exportHash) {
foo.display_hash = CONF.MIDDLE_WARE.exportHash;
}
if (CONF.MIDDLE_WARE.current_db_date != 'current') {
foo.display_date = CONF.MIDDLE_WARE.current_db_date + '15';
}
return foo;
}
)()
}, {
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
display_hash: CONF.MIDDLE_WARE.exportHashH,
action: "report",
type: "domain_rank_history",
display_sort: 'dt_desc',
responceAction: "rank_history"
}
}],
templates: {
header: HEADER_TEMPLATE,
content: CONTENT_TEMPLATE
},
table: {
header: [],
footer: ''
}
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
this.render();
},
render: function() {
var CONF = this.CONF;
this.report = new (app.ReportWidget.extend({
events: {
'click .sem-report-counter a': gaClickOnNumber,
},
getData: function(backendReports) {
this.CONF = CONF;
var backendModel, backendModelH, currentModel, models, lastMonth, col = new Backbone.Collection(), result = {
traffic: 0,
keyword_branded: 0,
branded_prev: 0,
branded_diff: 0
};
_.each(backendReports.toJSON(), function(model) {
if (typeof model.responce.attributes !== "undefined") {
if (model.type === "domain_rank") {
backendModel = model;
} else if (model.type === "domain_rank_history" && typeof model.display_daily == "undefined") {
backendModelH = model;
}
}
});
if (typeof backendModelH !== "undefined" && backendModelH.length) {
models = _.values(backendModelH.first())[0].models;
if (CONF.MIDDLE_WARE.current_db_date == "current") {
lastMonth = models[models.length - 1];
} else {
_.each(models, function(model) {
if (model.get("Dt") < CONF.MIDDLE_WARE.current_db_date) {
lastMonth = model;
}
});
}
if (lastMonth && lastMonth.get("Td")) {
result.branded_prev = lastMonth.get("Td");
}
}
if (typeof backendModel !== "undefined" && backendModel.length) {
currentModel = undefined;
_.each(backendModel.models, function(model) {
currentModel = model;
result.traffic = currentModel.get("Td") ? parseInt(currentModel.get("Td")) : 0;
result.keyword_branded = currentModel.get("Cd") ? parseInt(currentModel.get("Cd")) : 0;
})
}
var calcDiff = function(current, previous) {
current = current || 0;
previous = previous || 0;
var diff = current - previous;
if (previous > 0) {
diff = Math.round(100 * diff / previous);
} else if (current > 0) {
diff = 100;
}
return diff;
}
if (lastMonth && lastMonth.get("Td")) {
result.branded_diff = calcDiff(result.traffic, result.branded_prev);
}
col.push(result);
if (typeof backendModel !== "undefined") {
if (!result.traffic || !result.keyword_branded) {
$('#brandedTraffic').remove();
} else {
this._showNotification('branded-traffic-overview');
}
}
return col;
},
_showNotification: function(type) {
$('.' + type + '-notification').show();
},
_hideNotification: function(type) {
$('.' + type + '-notification').hide();
}
}))(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
, function(module, exports) {
module.exports = "<% if (typeof data !== \"undefined\" && data.length) {\n\t\tvar model = data.first(), sign, cssClass;\n%>\n\t<%\tsign = model.get(\"branded_diff\") > 0 ? \"+\" : \"\";\n\t\tcssClass = model.get(\"branded_diff\") > 0 ? 'positive' : (model.get(\"branded_diff\") == 0 ? \"\" : 'negative'); %>\n\t\n\t\t
\n\t\t\t<%= helper.roundNumRankFormatted(model.get(\"traffic\")) %>\n\t\t
\n\t\t
\n\t\t\t\n\t\t
\n\t\t
<%= LOCALE.traffic %>
\n\t
\n\t
\n\t\n<% } %>\n"
}
, function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(4), __webpack_require__(5)],
__WEBPACK_AMD_DEFINE_RESULT__ = function(_, Backbone) {
"use strict";
var getGaWidgetName = function() {
return 'Branded traffic trend'
}
var gaClickOnColumn = function(column) {
sendGa('click - ' + column);
}
var sendGa = function(label) {
var action = getGaWidgetName();
if (typeof ga !== 'undefined') {
ga('send', 'event', 'Domain overview', action, label);
}
}
return Backbone.View.extend({
initialize: function(options, reportConfig) {
var CONF = this.CONF = options;
this.reportConfig = {
el: $(CONF.EL),
title: CONF.LOCALE.title,
tooltip: CONF.LOCALE.title_tooltip,
MIDDLE_WARE: CONF.MIDDLE_WARE,
LOCALE: CONF.LOCALE,
gaLabel: getGaWidgetName() + ' - Overview',
reports: function() {
var backs = [{
back: {
key: app.conf.KEY,
url: CONF.MIDDLE_WARE.backend_url,
domain: CONF.MIDDLE_WARE.domain_id,
display_hash: CONF.MIDDLE_WARE.exportHash,
action: "report",
type: CONF.MIDDLE_WARE.is_new_api ? "branded_traffic_trend" : "domain_rank",
responceAction: CONF.MIDDLE_WARE.is_new_api ? "branded_traffic_trend" : "rank"
}
}];
if (CONF.MIDDLE_WARE.is_new_api) {
backs[0].back.database = CONF.MIDDLE_WARE.current_db;
backs[0].back.export = 'json';
}
return backs;
},
chartOptions: {
chart: {
type: "column",
height: 110,
spacingTop: 5,
spacingLeft: 10,
spacingRight: 10,
spacingBottom: 5,
backgroundColor: CONF.MIDDLE_WARE.show_watermark ? null : '#fff'
},
colors: ['#64b0e2'],
title: {
text: null
},
plotOptions: {
series: {
shadow: false
},
column: {
events: {
'click': function(e) {
gaClickOnColumn(e.target.point.index);
}
}
}
},
xAxis: {
gridLineWidth: 0,
tickWidth: 0,
lineWidth: 0,
labels: {
enabled: false
}
},
yAxis: {
showFirstLabel: false,
gridLineColor: "#dae4e7",
gridLineDashStyle: 'shortdash',
min: 0,
max: 1,
tickInterval: 0.5,
title: {
text: null
},
labels: {
style: {
fontSize: 10,
color: '#999999'
}
}
},
tooltip: {
snap: 2,
formatter: function() {
return this.series.name + ": " + app.numberFormat(this.y, 2, ".", ",");
}
},
legend: {
enabled: false
}
},
templates: {
header: function() {
return "";
}
},
getData: function(backendReports) {
if (CONF.MIDDLE_WARE.is_new_api) {
var data = _.compact(_.map(backendReports.toJSON(), function(item) {
return item.map(function(val) {
if (val.get("Bt"))
return parseFloat((val.get("Bt") / 100).toFixed(2));
});
}, this));
if (_.first(data).length > 0) {
return [{
name: CONF.MIDDLE_WARE.domain_id,
data: _.first(data)
}];
} else {
return [];
}
}
var trendData;
var data = _.compact(_.map(backendReports.toJSON(), function(item) {
return item.map(function(val) {
if (val.get("Bt"))
return val.get("Bt").split(",");
});
}, this));
if (data.length > 0) {
_.each(data, function(item) {
_.each(item, function(dot) {
trendData = _.map(dot, parseFloat);
});
});
return [{
name: CONF.MIDDLE_WARE.domain_id,
data: trendData
}];
} else {
return [];
}
},
labelClass: CONF.MIDDLE_WARE.labelClass,
labelText: CONF.MIDDLE_WARE.labelText
};
if (reportConfig) {
app.deepExtend(this.reportConfig, reportConfig);
}
return this.render();
},
render: function() {
this.report = new app.ReportChart(this.reportConfig);
}
});
}
.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
])
});
;