(function webpackUniversalModuleDefinition(root, factory) { if (typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("lodash"), require("backbone"), require("app/reports"), require("app/modal/modal"), require("lib/countries.json"), require("lib/countries-currency.json"), require("jquery"), require("moment"), require("lib/jquery.tipsy"), require("lib/highcharts/highcharts-more")); else if (typeof define === 'function' && define.amd) define(["lodash", "backbone", "app/reports", "app/modal/modal", "lib/countries.json", "lib/countries-currency.json", "jquery", "moment", "lib/jquery.tipsy", "lib/highcharts/highcharts-more"], factory); else { var a = typeof exports === 'object' ? factory(require("lodash"), require("backbone"), require("app/reports"), require("app/modal/modal"), require("lib/countries.json"), require("lib/countries-currency.json"), require("jquery"), require("moment"), require("lib/jquery.tipsy"), require("lib/highcharts/highcharts-more")) : factory(root["lodash"], root["backbone"], root["app/reports"], root["app/modal/modal"], root["lib/countries.json"], root["lib/countries-currency.json"], root["jquery"], root["moment"], root["lib/jquery.tipsy"], root["lib/highcharts/highcharts-more"]); for (var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } } )(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_5__, __WEBPACK_EXTERNAL_MODULE_13__, __WEBPACK_EXTERNAL_MODULE_15__, __WEBPACK_EXTERNAL_MODULE_16__, __WEBPACK_EXTERNAL_MODULE_18__, __WEBPACK_EXTERNAL_MODULE_19__, __WEBPACK_EXTERNAL_MODULE_20__, __WEBPACK_EXTERNAL_MODULE_29__) { return (function(modules) { var installedModules = {}; function __webpack_require__(moduleId) { if (installedModules[moduleId]) return installedModules[moduleId].exports; var module = installedModules[moduleId] = { exports: {}, id: moduleId, loaded: false }; modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); module.loaded = true; return module.exports; } __webpack_require__.m = modules; __webpack_require__.c = installedModules; __webpack_require__.p = "/m/build/domain-analytics/"; return __webpack_require__(0); } )([function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(29), __webpack_require__(82), __webpack_require__(69), __webpack_require__(100), __webpack_require__(74), __webpack_require__(38), __webpack_require__(101), __webpack_require__(103), __webpack_require__(105), __webpack_require__(107), __webpack_require__(109), __webpack_require__(80), __webpack_require__(111), __webpack_require__(114), __webpack_require__(116), __webpack_require__(118), __webpack_require__(120), __webpack_require__(123), __webpack_require__(124), __webpack_require__(126), __webpack_require__(12), __webpack_require__(21), __webpack_require__(87)], __WEBPACK_AMD_DEFINE_RESULT__ = function(_, highcharts, Summary, Keywords, KeywordsDistribution, Competitors, CompetitorsDistribution, Ads, SummaryFlagBacklinks, Follow, BacklinksTypeChart, Backlinks, BacklinksAnchors, BacklinksDomains, BacklinksPages, Publishers, Landings, AdsenseAds, BrandedTrafficChart, BrandedTrafficSummary, BrandedTrafficTrend, VideoTutorial, CurrencySwitcher, SummaryClassic) { "use strict"; return { highcharts: highcharts, Summary: Summary, Keywords: Keywords, KeywordsDistribution: KeywordsDistribution, Competitors: Competitors, CompetitorsDistribution: CompetitorsDistribution, Ads: Ads, SummaryFlagBacklinks: SummaryFlagBacklinks, Follow: Follow, BacklinksTypeChart: BacklinksTypeChart, Backlinks: Backlinks, BacklinksAnchors: BacklinksAnchors, BacklinksDomains: BacklinksDomains, BacklinksPages: BacklinksPages, Publishers: Publishers, Landings: Landings, AdsenseAds: AdsenseAds, BrandedTrafficChart: BrandedTrafficChart, BrandedTrafficSummary: BrandedTrafficSummary, BrandedTrafficTrend: BrandedTrafficTrend, VideoTutorial: VideoTutorial, CurrencySwitcher: CurrencySwitcher, SummaryClassic: SummaryClassic }; } .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_1__; } , , , function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_4__; } , function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_5__; } , , , , , , , 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__(13), __webpack_require__(5), __webpack_require__(14)], __WEBPACK_AMD_DEFINE_RESULT__ = function(_, Backbone, Modal, reports, tableHelpers) { "use strict"; return Backbone.View.extend({ el: "#sem-video-tutorial", initialize: function(options, reportConfig) { this.CONF = options; this.video = { height: 360, width: 640 }; var URL = this.parseUrl(decodeURIComponent(tableHelpers.removeSpecialChars(this.CONF.MIDDLE_WARE.video_url))); this.html = ''; this.render(); }, appendVideo: function() {}, render: function() { this.modal = new Modal().on('modal:open', _.bind(function() { $(this.el).addClass('sem-video-tutorial-open'); $(this.el).append(this.html); ga('send', 'event', 'Video tutorial', app.conf.PAGE_TITLE, app.conf.DB_NAME, null, { 'nonInteraction': 1 }); }, this)).on('modal:close', _.bind(function() { $(this.el).removeClass('sem-video-tutorial-open'); $(this.el).html(''); }, this)).render(); this.modal.getContentDom().append(this.el); $(".sem-video-tutorial-btn, .js-show-tutorial").on("click", _.bind(function() { this.modal.open(); }, this)); $(this.modal.getContentDom()).width(682); }, showVideo: function() { var boxUrl = "#TB_inline?height=" + this.video.height + "&width=" + this.video.width + "&inlineId=" + $(this.el).attr("id"); tb_show(this.CONF.LOCALE.video_title, boxUrl); }, parseUrl: function(url) { var a = document.createElement('a'); a.href = url; return { source: url, protocol: a.protocol.replace(':', ''), host: a.hostname, port: a.port, query: a.search, params: (function() { var ret = {}, seg = a.search.replace(/^\?/, '').split('&'), len = seg.length, i = 0, s; for (; i < len; i++) { if (!seg[i]) { continue; } s = seg[i].split('='); ret[s[0]] = s[1]; } return ret; } )(), file: (a.pathname.match(/\/([^\/?#]+)$/i) || [, ''])[1], hash: a.hash.replace('#', ''), path: a.pathname.replace(/^([^\/])/, '/$1'), relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [, ''])[1], segments: a.pathname.replace(/^\//, '').split('/') }; } }); } .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_13__; } , 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__(15), __webpack_require__(16), __webpack_require__(17), __webpack_require__(19), __webpack_require__(20)], __WEBPACK_AMD_DEFINE_RESULT__ = function(_, Backbone, geoCountries, countriesCurrency, cookiesUtils, moment, tipsy) { return (function($, app) { app.helper = { dispAdsColNumOfAds: function(domain_id, domain, total_ads, text_ads, media_ads, title_total, title_text_ads, title_media_ads, rep_type, sort, show_percent, className) { var by_rep_type = ""; text_ads_tmp = (Math.floor((text_ads / total_ads) * 100)).toString().substr(0, 3); text_ads = (text_ads != '0' && text_ads_tmp == '0') ? '1' : text_ads_tmp; media_ads = 100 - text_ads * 1; switch (rep_type) { case "top_adv": by_rep_type = "by+adsense_advertisers"; break; case "top_pub": by_rep_type = "by+adsense_publishers"; break; default: by_rep_type = "by+adsense_advertiser_publisher"; } if (total_ads == "0") return "0"; domain_id = domain_id == "" ? "" : domain_id; var a_total_ads = "" + total_ads + ""; if (text_ads == "0") { var a_text_ads = "0%"; } else { var a_text_ads = "" + text_ads + "%"; } if (media_ads == "0") { var a_media_ads = "0%"; } else { var a_media_ads = "" + media_ads + "%"; } if (typeof sort != "undefined") { sort = sort.indexOf("ads_count") == -1 ? "" : "sem-widget-sorted-td"; } else { sort = ""; } if (typeof show_percent == "undefined") { var ret = "" + a_total_ads + ""; } else { var ret = "" + "
" + "
" + a_text_ads + "
" + a_media_ads + "
"; } return ret; }, dispAdsDomainPub: function(domain) { var ret = ""; if (domain.length > 0) { ret += ''; ret += '' + domain + ''; } else { ret += this.displayLimits(); } ret += "" return ret; }, dispAdsDomainAdv: function(domain) { var ret = ""; if (domain.length > 0) { ret += ''; ret += '' + domain + ''; } else { ret += this.displayLimits(); } ret += "" return ret; }, dispAdsText: function(title, text, visible_url) { var ret = ""; if (title.length > 0) { ret += '

' + title + '

' + text + '

' + visible_url + '

'; } else { ret += this.displayLimits(); } ret += "" return ret; }, dispAdsMedia: function(media_url_id, media_url, media_type) { var ret = "
"; if (media_url_id.length > 0) { if (media_type == "image") { ret += '
'; } else if (media_type == "flash") { ret += '\
\ \ \ \ \ \ \ \
'; } } else { ret += this.displayLimits(); } ret += "
" return ret; }, dispAdsLandings: function(target_url) { var ret = ""; if (target_url.length > 0) { ret += '

'; ret += ' '; if (target_url.length >= 50) { ret += target_url.substring(0, 50) + '...'; } else { ret += target_url; } ret += '

'; } else { ret += this.displayLimits(); } ret += "" return ret; }, dispAgoDate: function(timestamp, locale_ago) { var time_ago_format = [[0, locale_ago[0]], [86400000, locale_ago[1]], [86400000 * 2, locale_ago[2]], [86400000 * 3, locale_ago[3]], [86400000 * 4, locale_ago[4]]]; var curTime = new Date().getTime(); var prevTime = new Date(timestamp).getTime(); var deltaTime = curTime - prevTime; var ret = ''; for (i = 0; i < time_ago_format.length - 1; i++) { if (deltaTime >= time_ago_format[i][0] && deltaTime < time_ago_format[i + 1][0]) { ret = time_ago_format[i][1]; break; } else { if (deltaTime >= time_ago_format[i + 1][0] && deltaTime < 86400000 * 5) ret = time_ago_format[i + 1][1]; else { ret = app.dateFormat('%e %b %Y', Number(timestamp)) } } } return ret; }, clipString: function(str, limit) { if (str.substring(0, 7) == 'http://') { str = str.substring(7); } else if (str.substring(0, 8) == 'https://') { str = str.substring(8); } if (str.length > limit) { return str.substring(0, 19) + '...' + str.substring(str.length - 9, str.length); } else { return str; } }, clipString2: function(str, limit) { if (str.length > limit) { return str.substring(0, 19) + '...' + str.substring(str.length - 9, str.length); } else { return str; } }, clipString3: function(str, limit, ad_key) { if (ad_key == 0) { if (str.substring(0, 7) == 'http://') { str = str.substring(7); } else if (str.substring(0, 8) == 'https://') { str = str.substring(8); } } if (str.length > limit) { return str.substring(0, 16) + '...' + str.substring(str.length - 6, str.length); } else { return str; } }, clipString4: function(str, limit) { if (str && str.length > limit) { return str.substring(0, limit) + '...'; } else { return str; } }, clipString5: function(str, limit, ad_key) { if (ad_key == 0) { if (str.substring(0, 7) == 'http://') { str = str.substring(7); } else if (str.substring(0, 8) == 'https://') { str = str.substring(8); } } if (str.length > limit) { return str.substring(0, limit - 9) + '...' + str.substring(str.length - 6, str.length); } else { return str; } }, clipUrl: function(str, limit) { if (str.substring(0, 7) == 'http://') { str = str.substring(7); } else if (str.substring(0, 8) == 'https://') { str = str.substring(8); } if (str && str.length > limit) { return str.substring(0, limit) + '...'; } else { return str; } }, clipWord: function(str, limit) { var words = str.split(' '); for (var i = 0; i < words.length; i++) { words[i] = this.clipString3(words[i], limit, 1); } str = words.join(' '); return str; }, calcRound: function(num) { var r_num, returnArray = new Array(2); if (num.length < 4) { returnArray[0] = num; returnArray[1] = ''; return returnArray; } else if (num.length > 3 && num.length < 7) { r_num = num / 1000; returnArray[0] = r_num.toFixed(1); returnArray[1] = 'k'; return returnArray; } else { r_num = num / 1000000; returnArray[0] = r_num.toFixed(1); returnArray[1] = 'm'; return returnArray; } }, calcRound3: function(num) { if (num != null && typeof (num) != "undefined") { if (num.length < 4) { return num; } else if (num.length > 3 && num.length < 7) { var r_num = num / 1000; return r_num.toFixed(1) + 'k'; } else { var r_num = num / 1000000; return r_num.toFixed(1) + 'm'; } } else { return 0; } }, calcRound2: function(num, contid, path, type, curdb, tip) { var str = new String(num), tmp_zurl, r_num; if (curdb == 'us') { tmp_zurl = ''; } else { tmp_zurl = '/' + curdb; } if (str.length < 4) { if (num != 0) { $('#' + contid).html('' + tip + ''); } return '
 
' + num + '
'; } else if (str.length > 3 && str.length < 7) { r_num = num / 1000; $('#' + contid).html('' + tip + ''); return '
k
' + r_num.toFixed(1) + '
'; } else { r_num = num / 1000000; $('#' + contid).html('' + tip + ''); return '
m
' + r_num.toFixed(1) + '
'; } }, breakToThree: function(num) { var reverse_string = "", reverse_array, straight_array; if (num == 0) { return 0; } for (var j = (num.length - 1); j >= 0; j--) { if (j < (num.length - 1) && j >= 0 && (num.length - (j + 1)) % 3 == 0) { reverse_string += ';psbn&'; } reverse_string += num.charAt(j); } reverse_array = reverse_string.split(""); straight_array = reverse_array.reverse(); return straight_array.join(""); }, breakToThreeComa: function(input) { var num = "", reverse_string = "", reverse_array, straight_array; num += input; if (num.length < 4) { return num; } for (var j = (num.length - 1); j >= 0; j--) { if (j < (num.length - 1) && j >= 0 && (num.length - (j + 1)) % 3 == 0) { reverse_string += ','; } reverse_string += num.charAt(j); } reverse_array = reverse_string.split(""); straight_array = reverse_array.reverse(); return straight_array.join(""); }, breakToThreeSpace: function(input) { var num = "", reverse_string = "", reverse_array, straight_array; num += input; if (num.length < 4) { return num; } for (var j = (num.length - 1); j >= 0; j--) { if (j < (num.length - 1) && j >= 0 && (num.length - (j + 1)) % 3 == 0) { reverse_string += ' '; } reverse_string += num.charAt(j); } reverse_array = reverse_string.split(""); straight_array = reverse_array.reverse(); return straight_array.join(""); }, ucfirst: function(str) { if (str) { return str.charAt(0).toUpperCase() + str.slice(1); } return ''; }, ucwords: function(str) { return str.replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); }) }, dispDom: function(domain, adsense, first, db_pref_custom, target, href, donotcutdomain) { var isIP = false; if (domain instanceof Array) { isIP = domain[0] ? false : true; domain = domain[0] || this.parseDomainFromURL(domain[1]); } var db_pref = (typeof db_pref_custom != "undefined") ? db_pref_custom : app.conf.DB_PREFIX; var target = (typeof target != "undefined") ? ' target="' + target + '"' : ''; href = (typeof href != "undefined") ? href : ""; var isSetDomain = (domain.length > 0) , ret = ' '; if (!isIP) { ret += ''; } if (typeof donotcutdomain == "undefined" || donotcutdomain == false) { ret += this.clipString4(domain, 25); } else { ret += domain; } if (!isIP) { ret += '  '; } if (typeof donotcutdomain == "undefined" || donotcutdomain == false) { ret += '
'; } } else { ret += this.displayLimits(); } ret += ''; return ret; }, addHttp: function(url) { var ret; if (url.substring(0, 7) != 'http://' && url.substring(0, 8) != 'https://') { ret = 'http://' + url; } else { ret = url; } return ret }, addHttps: function(url) { if (/^(http|https|\/\/)/.test(url) === true) { return url; } return 'https://' + url; }, dispDomain: function(domain, db_pref_custom, target, href, donotcutdomain, addClass) { var isIP = false; if (domain instanceof Array) { isIP = domain[0] ? false : true; domain = domain[0] || this.parseDomainFromURL(domain[1]); } var db_pref = (typeof db_pref_custom != "undefined") ? db_pref_custom : app.conf.DB_PREFIX; var target = (typeof target != "undefined") ? ' target="' + target + '"' : ''; href = (typeof href != "undefined") ? href : ""; var isSetDomain = (domain.length > 0) , ret = ''; } if (typeof donotcutdomain == "undefined" || donotcutdomain == false) { ret += this.clipString4(domain, 25); } else { ret += domain; } if (!isIP) { ret += '  '; } } else { ret += this.displayLimits(); } ret += ''; return ret; }, dispSearchEngine: function(engine, donotcut, addClass) { var isSetNetwork = (engine.length > 0) , ret = ' 0) , ret = ' 0) , ret = '' + undefinedKeyword + ''; } else if (keyword.length > 50) { keyword = "" + this.clipString4(keyword, 50) + ""; } return keyword; }, dispSubdomain: function(domain, donotcutdomain, addClass) { var isIP = false; if (domain instanceof Array) { isIP = domain[0] ? false : true; domain = domain[0] || this.parseDomainFromURL(domain[1]); } var db_pref = (typeof db_pref_custom != "undefined") ? db_pref_custom : app.conf.DB_PREFIX; href = (typeof href != "undefined") ? href : ""; var isSetDomain = (domain.length > 0) , ret = ' 0) , ret = ''; if (isSetDomain) { if (!isIP) { ret += ''; } if (typeof donotcutdomain == "undefined" || donotcutdomain == false) { ret += this.clipString4(display_text, 25); } else { ret += display_text; } if (!isIP) { ret += ''; } } return ret; }, dispDomainValue: function(domain, db_pref_custom, donotcutdomain) { var isIP = false; if (domain instanceof Array) { isIP = domain[0] ? false : true; domain = domain[0] || this.parseDomainFromURL(domain[1]); } var isSetDomain = (domain.length > 0) , ret = ''; if (isSetDomain) { if (typeof donotcutdomain == "undefined" || donotcutdomain == false) { ret += this.clipString4(domain, 25); } else { ret += domain; } } return ret; }, parseDomainFromURL: function(url) { var reg = new RegExp("(https?://)?([^/]*)(/.*)","i"); var res = reg.exec(url); return res[2]; }, dispOr: function(value, domain) { var ret = ''; if (typeof value == "undefined" || value == null) { ret += '-'; } else if (parseInt(value) == 0) { ret += value; } else { ret += '' + value + ''; } ret += ''; return ret; }, dispAd: function(value, domain) { var ret = ''; if (typeof value == "undefined" || value == null) { ret += '-'; } else if (parseInt(value) == 0) { ret += value; } else { ret += '' + value + ''; } ret += ''; return ret; }, dispTr: function(traffic, previousTraffic, sorted, addClass) { var ret = ''; } ret += ''; return ret; }, dispTr1: function(value, previousValue, sorted, ts, cellPosition, searchField, reportType) { Date.now = Date.now || function() { return +new Date; } var ret = ' 100 && Date.now() - ts * 1000 <= 24 * 3600 * 1000) { ret += '
'; } if (typeof searchField != "undefined" && searchField) { ret += ''; } ret += (typeof value == "undefined" || value == null) ? '-' : this.dispTraffic(value); if (typeof searchField != "undefined" && searchField) { ret += ""; } if (typeof previousValue != "undefined" && previousValue != null) { ret += ' (' + previousValue + ')'; } if (value > 100 && Date.now() - ts * 1000 <= 24 * 3600 * 1000) { ret += '
This keyword was recently updated, and isn’t included in the domain’s traffic statistics. At this time, expected monthly traffic from the given keyword to the website is higher than all traffic that the domain could get, and the percentage overruns 100%. With a new update, traffic share of the given keyword will be included in domain’s traffic share, and percentage will be no longer more than 100%.
'; } ret += ''; return ret; }, dispTraffic: function(traffic) { if (Math.ceil((parseFloat(traffic) * 100) / 100) === 0) { return "< 0.01"; } return traffic; }, dispTrBar: function(traffic) { var ret = ''; ret += '
'; ret += ''; return ret; }, dispTc: function(costs, previousCosts, sorted, addClass) { var ret = ''; } ret += ''; return ret; }, dispMinValue: function(value, minValue, sorted, addClass) { var cellValue = '-'; if (typeof value != "undefined" && value) { value = parseInt(value); if (typeof minValue != "undefined" && minValue && parseInt(value) < minValue) { cellValue = '< ' + minValue; } else { cellValue = this.breakToThreeComa(value); } } return this.dispTableCell(cellValue, sorted, addClass); }, dispDefValue: function(value, sorted, addClass, defValue) { var cellValue = (typeof defValue !== 'undefined') ? defValue : '-'; if (typeof value != "undefined" && parseInt(value)) { cellValue = this.breakToThreeComa(value); } return this.dispTableCell(cellValue, sorted, addClass); }, dispTableCell: function(value, sorted, addClass) { var ret = ''; ret += (typeof value == "undefined" || value == null) ? '-' : value; ret += ''; return ret; }, _cellClass: function(sorted, addClass) { var cellClass = ['right']; if (typeof sorted != "undefined" && sorted) { cellClass.push('sem-widget-sorted-td'); } if (typeof addClass != "undefined" && addClass) { cellClass.push(addClass); } return cellClass.join(' '); }, dispValue: function(value, previousValue, sorted, additionalClass) { var ret = ''; } ret += ''; return ret; }, dispTextValue: function(value, sorted) { var ret = ''; } if (typeof value != "undefined" && parseInt(value)) { ret += this.breakToThreeComa(value); } if (typeof searchField != "undefined" && searchField) { ret += ''; } ret += ""; return ret; }, getCompRelevance: function(num, newdesign) { function rationalTanh(x) { if (x < -3) return -1; else if (x > 3) return 1; else return x * (27 + x * x) / (27 + 9 * x * x); } var calculatedRelevance, relevance = parseFloat(num); if (relevance > 100) { relevance = 100; } if (relevance >= 0 && relevance < 7) { calculatedRelevance = 40 * rationalTanh((relevance - 5) / 2) + 40; } else { if (typeof newdesign != "undefined") { calculatedRelevance = 60 * rationalTanh((relevance + 10) / 40) + 50; } else { calculatedRelevance = 50 * rationalTanh((relevance + 10) / 40) + 50; } } if (calculatedRelevance > 100) { calculatedRelevance = 100; } return [calculatedRelevance, relevance]; }, dispCR: function(domain, num, sorted, newdesign) { var calculatedRelevance, relevance, compRelArr = this.getCompRelevance(num, newdesign); calculatedRelevance = compRelArr[0]; relevance = compRelArr[1]; var td = ' 0) { if (relevance < 0) { td += '>N/A'; } else { td += '>
'; } } else { td += '>' + this.displayLimits() + ''; } return td; }, dispSimilarity: function(domain, similarity, sorted) { return this.dispCR(domain, similarity * 100, sorted, true); }, dispTrafficShare: function(traffic, postfix) { var result = Math.round(parseFloat(traffic) * 100) / 100; if (!postfix) { postfix = '' } if (result === 0) { if (parseFloat(traffic) > 0.00001) { result = "< 0.01" + postfix } else { result = "-"; } } else { if (Math.round(parseFloat(traffic)) - result == 0) { result = result + '.00' + postfix } else if (Math.round(parseFloat(traffic) * 10) - result * 10 == 0) { result = result + '0' + postfix } else { result += postfix } } return result; }, dispCKw: function(domain, main_domain, kws, request_type, sorted) { var ret = ' 0) { ret += 'align="right">'; ret += '' + this.calcRound3(kws) + ''; } else { ret += 'align="center">'; ret += this.displayLimits(); } ret += ""; return ret; }, replaceLG: function(input) { var output = input.replace(/<b>/gi, ''); return output.replace(/<\/b>/gi, ''); }, dispURLImage: function(url, v_url, kw) { if (url instanceof Array) url = url[1]; if (kw.length > 0) { return ''; } return; }, dispURL: function(url, v_url, kw, wordWrap, noClip) { var isIP = false; if (url instanceof Array) { isIP = url[0] ? false : true; url = url[1]; } var ret = ""; if (kw.length > 0) { ret += (!wordWrap) ? '' : ''; if (url == v_url) { var adw_key = 0; var add_v_url = ''; if (!noClip) ret += ''; if (!isIP) { ret += ''; } ret += (noClip) ? v_url : this.clipString3(v_url, 30, adw_key); if (!isIP) { ret += ''; } } else { adw_key = 1; if (v_url.substring(0, 7) != 'http://' && v_url.substring(0, 8) != 'https://') { var add_v_url = 'http://'; } else { var add_v_url = ''; } if (!noClip) ret += ''; if (!isIP) { ret += ''; } ret += (noClip) ? v_url : this.clipString3(this.replaceLG(v_url), 25, adw_key); if (!isIP) { ret += ''; } } ret += (!wordWrap) ? '' : ''; } else { if (url != v_url && app.conf.UPLIM_ADW.length > 0) { ret += '' + app.conf.UPLIM_ADW + ''; } else { ret += this.displayLimits(); } } return ret; }, dispURL_: function(url, v_url, kw, wordWrap, noClip) { var isIP = false; if (url instanceof Array) { isIP = url[0] ? false : true; url = url[1]; } var ret = ""; if (kw.length > 0) { ret += (!wordWrap) ? '' : ''; if (url == v_url) { var adw_key = 0; var add_v_url = ''; if (!noClip) ret += ''; if (!isIP) { ret += ''; } ret += (noClip) ? v_url : this.clipUrl(v_url, 150); if (!isIP) { ret += ''; } } else { adw_key = 1; if (v_url.substring(0, 7) != 'http://' && v_url.substring(0, 8) != 'https://') { var add_v_url = 'http://'; } else { var add_v_url = ''; } if (!noClip) ret += ''; if (!isIP) { ret += ''; } ret += (noClip) ? v_url : this.clipUrl(this.replaceLG(v_url), 150); if (!isIP) { ret += ''; } } ret += (!wordWrap) ? '' : ''; } else { if (url != v_url && app.conf.UPLIM_ADW.length > 0) { ret += '' + app.conf.UPLIM_ADW + ''; } else { ret += this.displayLimits(); } } return ret; }, dispKwPos: function(Po, Pp, sorted) { var ret = ''; }, dispAdwordsBlock: function(bl, kw, is_adwords, domain, position, timestamp, ignore_date_prefix) { var a = ' 0) { if (typeof ignore_date_prefix != "undefined" && ignore_date_prefix) a += 'target="_blank" href="' + app.conf.DB_PREFIX + "/info/" + encodeURIComponent(kw).replace(/%20/g, '+') + '+(source)'; else a += 'target="_blank" href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + encodeURIComponent(kw).replace(/%20/g, '+') + '+(source)'; if (typeof domain != "undefined" && typeof position != "undefined") { a += '?domain=' + domain + '&position=' + position; if (is_adwords == 1) { a += '&type=adwords'; } if (typeof timestamp != "undefined" && timestamp > 100000000) { a += '&ts=' + timestamp; } } else if (typeof timestamp != "undefined" && timestamp > 100000000) { a += '?ts=' + timestamp; } a += '"'; } else { a += 'target="_blank" href="' + app.conf.DB_PREFIX + '/limit_results/"' + app.conf.ADD_REG_FORM; } a += '>'; return a; }, dispKwPosHistorical: function(Po, Pp, sorted, allowHistorical) { var ret = ' 0) { ret += 'color: #090; "'; } else if (Pd < 0) { ret += 'color: #c00; "'; } if (typeof sorted != "undefined" && sorted) { ret += ' class="sem-widget-sorted-td"'; } ret += '>'; ret += (Pd > 0) ? "+" + Pd : Pd; ret += ''; return ret; }, dispPositions: function(Ps, index, sorted) { var ret = ' 365 * 24 * 60 * 60) { return '-'; } else { date = new Date(date * 1000); return app.conf.MONTH_SHORT_NAMES[date.getMonth()] + " " + date.getFullYear(); } }, dispNqHistory: function(volumes, sorted, addClass) { var Nq, ret = ""; if (typeof volumes[0] != "undefined") { Nq = volumes[0]["Nq"]; ret += ''; } return ret; }, dispCvHistory: function(cv, sorted) { return '' + cv + ''; }, dispRkHistory: function(Rk, Hs, sorted) { var ret = ""; if (typeof Hs[0] != "undefined") { var ret = ''; } return ret; }, dispCPCHistory: function(cpcs, sorted) { var Cp, ret = ""; if (typeof cpcs[0] != "undefined") { Cp = cpcs[0]["Cp"]; if (!Cp && cpcs[0]["Nq"] != "") { Cp = "0.00"; } ret += ''; } return ret; }, dispTrHistory: function(Tr, volumes, sorted, addClass) { var hasVolume = true; if (volumes && typeof volumes[0] != "undefined" && !volumes[0]["Nq"]) { hasVolume = false; } var ret = ''; return ret; }, dispPositionHistory: function(positions, limit, title) { var i = 0, Po, ret = "", td = ""; while (typeof positions[i] != "undefined") { td = ""; Po = positions[i]["Po"]; td += ''; td += Po; } else if (Po < 0) { td += '-empty">
' + '
' + '
' + '
'; _.each(_.values(ads).reverse(), function(item, index) { if (item["Po"] == "" || item["Po"] <= 0) { previousMonth = 0; return; } month = parseInt(item["Dt"].substr(4, 2), 10); year = parseInt(item["Dt"].substr(0, 4), 10); if (previousMonth == 0 && spacerMonth > 0) { var startMonth = (spacerMonth > 11) ? 1 : spacerMonth + 1; var startYear = (startMonth < month) ? year : year - 1; var endMonth = (month <= 1) ? 12 : month - 1; var endYear = (endMonth < month) ? year : year - 1; ret += '
' + '
' + '
' + ((endMonth == startMonth) ? app.conf.MONTH_SHORT_NAMES[startMonth - 1] + ' ' + startYear : app.conf.MONTH_SHORT_NAMES[startMonth - 1] + ' ' + startYear + ' - ' + app.conf.MONTH_SHORT_NAMES[endMonth - 1] + ' ' + endYear) + '
' + '
 
' + '
'; } index = parseInt(index, 10) + 1; item["Ds"] = item["Ds"].replace(/]*>(.+)?<\/table>/ig, ""); item["Ds"] = item["Ds"].replace(/]*>(.+)?<\/span>/ig, ""); item["Ds"] = item["Ds"].replace(/]*>(.+)?<\/a>/ig, ""); item["Ds"] = item["Ds"].replace(/ $/ig, ""); item["Ds"] = item["Ds"].replace(/
$/ig, ""); item["Ds"] = item["Ds"].replace(/]*>/ig, ""); item["Ds"] = item["Ds"].replace(/<\/div>/ig, ""); if (item["Cp"] == "") { item["Cp"] = (item["Nq"] == "" ? "n/a" : "0.00"); } ret += '
' + '
' + '
' + app.conf.MONTH_NAMES[month - 1] + ' ' + year + '
' + '
'; if (typeof new_design !== "undefined") { ret += '' + item["Tt"] + '' + '
Ad' + _this.clipString3(item["Vu"], 30, 0) + '
' + '
' + item["Ds"] + '
'; } else { ret += '' + '
' + item["Ds"] + '
' + '' + _this.clipString3(item["Vu"], 30, 0) + ''; } ret += '
' + ((typeof item["Nq"] != "undefined" && typeof item["Cp"] != "undefined") ? '
Volume: ' + _this.breakToThreeComa(item["Nq"]) + '; CPC: ' + item["Cp"] + '
' : '') + '
'; spacerMonth = parseInt(item["Dt"].substr(4, 2), 10); previousMonth = spacerMonth; }); ret += '
'; return ret; }, dispRoundNum: function(num, addClass) { var cellClass = "right"; if (typeof addClass != "undefined" && addClass) { cellClass += ' ' + addClass; } return '' + this.calcRound3(num) + ''; }, dispRoundNumWithA: function(num, path, addClass) { var cellClass = "right"; if (typeof addClass != "undefined" && addClass) { cellClass += ' ' + addClass; } var ret = ''; ret += '' + this.calcRound3(num) + ''; return ret + ''; }, dispKw: function(kw, first, db_pref_custom, target, href, hasFeatures, options) { if (hasFeatures) { return this.dispKwFeatures(kw, first, db_pref_custom, target, href, options); } var db_pref = (typeof db_pref_custom != "undefined") ? db_pref_custom : app.conf.DB_PREFIX; var target = (typeof target != "undefined") ? ' target="' + target + '"' : ''; href = (typeof href != "undefined") ? href : " (keyword)"; var ret = ' 0) { ret += '>' + this.clipWord(kw, 30) + ''; } else { ret += ' align="center">'; ret += this.displayLimits(); } ret += "" return ret; }, dispKwFeatures: function(kw, first, db_pref_custom, target, href, options) { var db_pref = (typeof db_pref_custom != "undefined") ? db_pref_custom : app.conf.DB_PREFIX; var target = (typeof target != "undefined") ? ' target="' + target + '"' : ''; href = (typeof href != "undefined") ? href : " (keyword)"; options = options || {}; var ret = ' 0) { ret += '>
'; ret += '' + this.clipWord(kw, 30) + ''; ret += '
'; if (options.locale && options.categories) { ret += '

' + options.locale.categories + '

'; ret += '
    '; ret += _.map(options.categories, function(value) { return '
  • ' + options.locale['filters_Ca_' + value] + '
  • '; }).join(''); ret += '
'; } if (options.locale && options.serpfeatures) { ret += '

' + options.locale.serp_features + '

'; ret += '
    '; ret += _.map(options.serpfeatures, function(value) { var item = '
  • '; if (value < 0) { item += options.locale['filters_Fl_' + Math.abs(value)] + ' (' + options.locale.serp_features_note + ')'; } else { item += options.locale['filters_Fl_' + value]; } return item + '
  • '; }).join(''); ret += '
'; } ret += '
'; } else { ret += ' align="center">'; ret += this.displayLimits(); } ret += "" return ret; }, roundNumRankNew: function(i) { i = parseInt(i, 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'; }, roundNumRankFormatted: function(i, prefix, helpOverlay, helpOverlayPosition) { i = parseInt(i, 10); var ret = '' , ho = ''; if (typeof prefix == "undefined") prefix = ''; if (helpOverlay && helpOverlayPosition) { ho = "data-helpoverlay='" + helpOverlay + "' data-helpoverlay-position='" + helpOverlayPosition + "'"; } if (isNaN(i)) i = 0; if (i < 1000) ret = prefix + i; else if (i < 1000000) ret = prefix + (i / 1000).toFixed((i / 1000) > 100 ? 0 : 1) + 'K'; else if (i < 1000000000) ret = prefix + (i / 1000000).toFixed((i / 1000000) > 100 ? 0 : 1) + 'M'; else ret = prefix + (i / 1000000000).toFixed((i / 1000000000) > 100 ? 0 : 1) + 'B'; return "" + ret + ""; }, roundNumRank: function(i) { i = parseInt(i, 10); if (isNaN(i)) return 0; if (i < 1000) return i; else if (i < 1000000) return (i / 1000).toFixed((i / 1000) > 100 ? 0 : 1) + 'K'; else if (i < 1000000000) return (i / 1000000).toFixed((i / 1000000) > 100 ? 0 : 1) + 'M'; else return (i / 1000000000).toFixed((i / 1000000000) > 100 ? 0 : 1) + 'B'; }, getUsersCurrency: function() { var currency = cookiesUtils.getCookie("currency"); return (typeof currency != 'undefined') ? currency : 'usd'; }, formatPriceRoundNum: function(val, db_currency) { return this.formatPrice(this.roundNumRank(val), db_currency); }, formatPrice: function(val, db_currency) { return this.formatCurrency.formatStringByCode(val, db_currency); }, replaceAdvDescription: function(text) { if (text != undefined) { text = text.replace(/]*>(.+)?<\/span>/ig, ""); text = text.replace(/]*>(.+)?<\/a>/ig, ""); if (text.match(/]*>/ig) && !text.match(/<\/table>/ig)) { text = ''; } text = text.replace(/]*>(.+)?<\/table>/ig, ""); text = text.replace(/ $/ig, ""); text = text.replace(/
$/ig, ""); } return text; }, dispKeywordDifficulty: function(diff, sorted) { var ret = ' 0) { ret += diff; } else { ret += '-'; } ret += ''; return ret; }, makeTrend: function(trend) { var trends = '' , foo = ''; }, dispSource: function(kw, is_adwords, domain, position, timestamp, ignore_date_prefix) { var a = ' '; } a += "data-serp='link' onclick=\"ga('send', 'event', 'DPA', 'SERP icon clicked at " + app.conf.REPORT_TYPE + "', 'DB " + (app.conf.DB_DATE_PREFIX ? (app.conf.DB_DATE_PREFIX).replace('/', '') : 'US') + "')\" "; var href = app.conf.DB_PREFIX; if (typeof ignore_date_prefix == "undefined" || !ignore_date_prefix) { href += app.conf.DB_DATE_PREFIX; } href += "/info/" + encodeURIComponent(kw) + "+(source)"; var hrefParams = {}; if (typeof domain != "undefined" && typeof position != "undefined") { hrefParams.domain = domain; if (is_adwords !== 1) { hrefParams.position = parseInt(position); } if (is_adwords == 1) { hrefParams.type = 'adwords'; } else if (is_adwords == 2) { hrefParams.type = 'shopping'; } } if (typeof timestamp != "undefined" && timestamp > 100000000) { hrefParams.ts = timestamp; } if ((_.keys(hrefParams)).length) { href += '?' + $.param(hrefParams); } a += ' href="' + href + '"> '; return a; }, showSerpExpired: function(db_date) { if (db_date == 'current') { return true; } var expired_date = moment().subtract(3, 'month').format('YYYYMM'); return (expired_date < db_date); }, dispDifference: function(difference, value, sorted, clipped) { var diff, upDown, classes = "", ret = ""; if (difference == 0) diff = '0%'; else if (value == difference) diff = 'infinity'; else if (value == 0 && difference < 0) diff = '-100%'; else { var upDown = (difference / ((value - difference) / 100)); if (upDown < 1 && upDown > -1) diff = upDown.toFixed(2) + '%'; else if (upDown < 1000 && upDown > -1000) diff = upDown.toFixed(1) + '%'; else { if (upDown < 0) { if (typeof clipped != "undefined") { diff = '-' + this.roundNumRankNew((-1 * upDown.toFixed(0))) + '%'; } else { diff = '-' + this.breakToThreeSpace((-1 * upDown.toFixed(0))) + '%'; } } else { if (typeof clipped != "undefined") { diff = this.roundNumRankNew(upDown.toFixed(0)) + '%'; } else { diff = this.breakToThreeSpace(upDown.toFixed(0)) + '%'; } } } } if (typeof sorted != "undefined" && sorted) { classes += ' class="sem-widget-sorted-td"'; } ret += ' 0) { if (typeof clipped != "undefined") { ret += 'color:#090;">' + this.roundNumRankNew(difference); } else { ret += 'color:#090;">' + this.breakToThreeComa(difference); } } else { ret += '">' + difference; } ret += ''; return ret; }, strClipOld: function(i, l, t, h, w) { if (i == null || i == undefined) return ''; var s = new String(""); s += i; if (h) s = s.replace(/^http[s]?:\/\//ig, ''); if (w) s = s.replace(/^www\./ig, ''); if (l >= s.length) return s; if (t == 'right') return s.substring(0, l) + '...'; if (t == 'center') { var r = Math.floor(l / 2); return s.substring(0, r) + '...' + s.substring(s.length - r, s.length); } return s; }, makeBigTrend: function(trend, no_trend_data) { if (trend.length == 0) return '
' + no_trend_data + '
'; else { var trend_array = trend.split(","); var trind_str = new String(''); $.each(trend_array, function(j, trend_block) { var block_height = trend_block * 60; trind_str += ''; }); return trind_str += '
'; trind_str += '
 
'; trind_str += '
'; } }, displayCountryFlag: function(country) { var title = (typeof geoCountries[country] != 'undefined') ? geoCountries[country] : country , ret = '' + country.toUpperCase() + ''; return ret; }, displayDatabaseFlag: function(db) { db = _.replace(db, /(bing-|mobile-|-ext)/, ''); return ""; }, displayRefDomainLink: function(member) { if (!member || member.length === 0) { var link = jQuery('').attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM); return jQuery("").append(link).html(); } var cnt = jQuery("") , dLink = jQuery("", { 'class': 'sem-widget-url-img', 'title': 'http://' + member, 'target': '_blank', 'href': 'http://' + member }).appendTo(cnt) , iLink = jQuery("", { 'href': app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + member }).text(member).appendTo(cnt); return cnt.html() }, displayRefIP: function(ipAddr) { if (!ipAddr || ipAddr.length === 0) { var link = jQuery('').attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM); return jQuery("").append(link).html(); } return ipAddr; }, displayTLD: function(zone) { if (!zone || zone.length === 0) { var link = jQuery('').attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM); return jQuery("").append(link).html(); } return '.' + zone; }, displayCountry: function(country) { if (!country || country.length === 0) { var link = jQuery('').attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM); return jQuery("").append(link).html(); } return geoCountries[country] ? geoCountries[country] : country; }, crossLinkToFilteredReport: function(reportItem, displayItem, destination, filterType, reportTarget, reportTargetType) { if (!reportItem || reportItem.length === 0) { return this.breakToThreeComa(displayItem); } if (reportItem == '') reportItem = ''; var sign = (filterType == 'anchor' || filterType == 'refdomain' || filterType == 'ip') ? 'Eq' : ''; var href = app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + reportTarget + '+(' + destination + ')?target_type=' + reportTargetType + '&filter=%2B%7C' + filterType + '%7C' + sign + '%7C' + encodeURIComponent(reportItem); link = $('').attr('href', href).text(this.breakToThreeComa(displayItem)); return $('').append(link).html(); }, displayBacklinkLink: function(member) { var td = $('').addClass('table-first-cell'), c = $('
'), t = $('
'), u = $('
').addClass('backlinks-divlinks'), a = $(''), tl = $('
').addClass('backlinks-divlinks'), tla = $(''), stu = $('').addClass('backlinks-tslink-span').text('Target URL: '), ssu = $('').addClass('backlinks-tslink-span').text('Source URL: '), trimmedURL = member.source_url, trimmedTitle; if (member.source_url.length == 0) { a.attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM); } else if (member.source_url.length > 60) { trimmedURL = this.strClipOld(member.source_url, 60, 'right', false, false); u.attr('title', member.source_url); u.append(ssu); if (member.source_url.substring(0, 7) != 'http://' && member.source_url.substring(0, 8) != 'https://') { a.attr('href', 'http://' + member.source_url).text(trimmedURL); } else { a.attr('href', member.source_url).text(trimmedURL); } } else { u.append(ssu); if (member.source_url.substring(0, 7) != 'http://' && member.source_url.substring(0, 8) != 'https://') { a.attr('href', 'http://' + member.source_url).text(trimmedURL); } else { a.attr('href', member.source_url).text(trimmedURL); } } if (member.source_title != undefined && member.source_title.length > 0) { if (member.source_title.length > 150) { trimmedTitle = this.strClipOld(member.source_title, 150, 'right', false, false); t.attr('title', member.source_title); } else { trimmedTitle = member.source_title; } t.text(trimmedTitle); t.addClass('backlinks-titles'); c.append(t); } u.append(a); c.append(u); if (member.source_url.length > 0 && member.target_url != undefined && member.target_url.length > 0) { var clluuu; if (member.target_url.length > 60) { clluuu = this.strClipOld(member.target_url, 60, 'right', false, false); tla.attr('title', member.target_url); tl.append(stu); if (member.target_url.substring(0, 7) != 'http://' && member.target_url.substring(0, 8) != 'https://') { tla.attr('href', 'http://' + member.target_url).text(clluuu); } else { tla.attr('href', member.target_url).text(clluuu); } } else { clluuu = member.target_url; tl.append(stu); if (member.target_url.substring(0, 7) != 'http://' && member.target_url.substring(0, 8) != 'https://') { tla.attr('href', 'http://' + member.target_url).text(clluuu); } else { tla.attr('href', member.target_url).text(clluuu); } } tl.append(tla); c.append(tl); } td.append(c); return '' + td.html() + ''; }, displayBacklinkLinkSource: function(member) { var td = $('').addClass('table-first-cell'), content = $('
'), title = $('
'), bl_div = $('
').addClass('backlinks-divlinks'), anchor = $(''), trimmedURL = member.source_url, trimmedTitle; if (member.source_url.length == 0) { anchor.attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM); } else { if (member.source_url.length > 45) { trimmedURL = this.strClipOld(member.source_url, 45, 'right', false, false); bl_div.attr('title', member.source_url); } if (member.source_url.substring(0, 7) != 'http://') { anchor.attr('href', 'http://' + member.source_url).text(trimmedURL); } else { anchor.attr('href', member.source_url).text(trimmedURL); } } if (member.source_title != undefined && member.source_title.length > 0) { if (member.source_title.length > 50) { trimmedTitle = this.strClipOld(member.source_title, 50, 'right', false, false); title.attr('title', member.source_title); } else { trimmedTitle = member.source_title; } title.text(trimmedTitle); title.addClass('backlinks-titles'); content.append(title); } bl_div.append(anchor); content.append(bl_div); td.append(content); return '' + td.html() + ''; }, displayBacklinksPagesLink: function(member) { var td = $('').addClass('table-first-cell'), c = $('
'), t = $('
'), u = $('
').addClass('backlinks-divlinks'), a = $(''), ssu = $('').addClass('backlinks-tslink-span'), trimmedURL = member.source_url, trimmedTitle; if (member.source_url.length == 0) { a.attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM); } else if (member.source_url.length > 60) { trimmedURL = this.strClipOld(member.source_url, 60, 'right', false, false); u.attr('title', member.source_url); u.append(ssu); if (member.source_url.substring(0, 4) != 'http') { a.attr('href', 'http://' + member.source_url).text(trimmedURL); } else { a.attr('href', member.source_url).text(trimmedURL); } } else { u.append(ssu); if (member.source_url.substring(0, 4) != 'http') { a.attr('href', 'http://' + member.source_url).text(trimmedURL); } else { a.attr('href', member.source_url).text(trimmedURL); } } if (member.source_title != undefined && member.source_title.length > 0) { if (member.source_title.length > 150) { trimmedTitle = this.strClipOld(member.source_title, 150, 'right', false, false); t.attr('title', member.source_title); } else { trimmedTitle = member.source_title; } t.text(trimmedTitle); t.addClass('backlinks-titles'); c.append(t); } u.append(a); c.append(u); td.append(c); return '' + td.html() + ''; }, displayBacklinkAnchor: function(member) { var td = $('').attr('align', 'left'); var anchorTxt = member.anchor; if (anchorTxt.length > 0) { if (anchorTxt.length > 40) { anchorTxt = this.strClipOld(anchorTxt, 40, 'right', false, false); } var div = $('
').text(anchorTxt); td.append(div).addClass('backlinks-anchors'); } else { td.html(' '); } return '' + td.html() + ''; }, displayBacklinkAnchorTarget: function(member) { var td = $('').attr('align', 'left') , content = $('
') , bl_div = $('
').addClass('backlinks-divlinks') , anchor = $(''); var anchorTxt = member.anchor; if (anchorTxt.length > 0) { if (anchorTxt.length > 40) { anchorTxt = this.strClipOld(anchorTxt, 40, 'right', false, false); } var div = $('
').text(anchorTxt); td.append(div).addClass('backlinks-anchors'); } else { td.html(' '); } if (member.source_url.length > 0 && member.target_url != undefined && member.target_url.length > 0) { var clluuu; if (member.target_url.length > 45) { clluuu = this.strClipOld(member.target_url, 45, 'right', false, false); anchor.attr('title', member.target_url); if (member.target_url.substring(0, 7) != 'http://') { anchor.attr('href', 'http://' + member.target_url).text(clluuu); } else { anchor.attr('href', member.target_url).text(clluuu); } } else { clluuu = member.target_url; if (member.target_url.substring(0, 7) != 'http://') { anchor.attr('href', 'http://' + member.target_url).text(clluuu); } else { anchor.attr('href', member.target_url).text(clluuu); } } bl_div.append(anchor); content.append(bl_div); td.append(content); } return '' + td.html() + ''; }, displayFormattedAnchor: function(member) { if (member == '') { return 'Empty Anchor'; } return _.escape(member); }, displayBacklinkRank: function(member) { var td = $('').attr('align', 'left'); if (member.rank || member.rank === 0) { var div = $('
').text(member.rank); td.append(div).addClass('backlinks-anchors'); } else { td.html(' '); } return '' + td.html() + ''; }, displayBacklinkExternalLinks: function(member) { var td = $('').attr('align', 'right'); if (member.external_link_num || member.external_link_num === 0) { var div = $('
').text(member.external_link_num); td.append(div).addClass('backlinks-anchors'); } else { td.html(' '); } return '' + td.html() + ''; }, displayBacklinkInternalLinks: function(member) { var td = $('').attr('align', 'right'); if (member.internal_link_num || member.internal_link_num === 0) { var div = $('
').text(member.internal_link_num); td.append(div).addClass('backlinks-anchors'); } else { td.html(' '); } return '' + td.html() + ''; }, displayBacklinkLastSeenDate: function(member) { var td = $(''); if (member.last_seen != undefined && member.last_seen > 0) { var date = new Date(member.last_seen * 1000); var month = months[date.getMonth()] , year = date.getFullYear() , day = date.getDate(); td.html(day + ' ' + month + ' ' + year); td.addClass('backlinks-date'); } else { td.html(' '); } return td.html(); }, displayBacklinkFirstSeenDate: function(member) { var td = $(''); if (member.first_seen != undefined && member.first_seen > 0) { var date = new Date(member.first_seen * 1000); var month = months[date.getMonth()] , year = date.getFullYear() , day = date.getDate(); td.html(day + ' ' + month + ' ' + year); td.addClass('backlinks-date'); } else { td.html(' '); } return td.html(); }, displayBacklinkType: function(member) { var td = $(''); if (!member.nofollow && !member.frame && !member.form && !member.image && !member.sitewide) { return ' '; } if (member.nofollow) { var div = $('
').addClass("sem-backlinks-type bl-nofollow"); td.append(div) } if (member.frame) { var div = $('
').addClass("sem-backlinks-type bl-frame"); td.append(div) } if (member.form) { var div = $('
').addClass("sem-backlinks-type bl-form"); td.append(div) } if (member.image) { var div = $('
').addClass("sem-backlinks-type bl-image"); td.append(div) } if (member.sitewide) { var div = $('
').addClass("sem-backlinks-type bl-sitewide"); td.append(div) } return '' + td.html() + ''; }, displayBacklinksComparisonValueLink: function(currentProperty, propsArray, href) { if (typeof currentProperty === 'undefined') currentProperty = 0; var parsed = parseInt(currentProperty) var parsedMax = parseInt(Math.max.apply(Math, propsArray)) var parsedMin = parseInt(Math.min.apply(Math, propsArray)) if (parsed == 0) return this.roundNumRankNew(parsed) if (parsedMax == parsed) return '' + this.roundNumRankNew(parsed) + '' if (parsedMin == parsed) return '' + this.roundNumRankNew(parsed) + '' return '' + this.roundNumRankNew(parsed) + ''; }, dispAdCopy: function(url, txt, desc, v_url, kw) { var td = $('').attr('align', 'center').addClass('table-first-cell').addClass('ads-wr-open'); var img_w = $('
').addClass('sem-widget-ad-icon'); if (kw.length > 0) { txt = txt.replace(/<\/a>.+/i, ""); 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, ""); img_w.addClass('sem-widget-ad-icon-active'); var div = $('
').addClass('sem-widget-ad-view'); var divStyle = $('
').addClass('sem-widget-ad-view-style'); var divttl = $('').addClass('ads-ln').attr({ 'href': url, 'target': '_blank' }).html(txt); var divd = $('
').addClass('ads-d').html(desc); var cite = $('').addClass('ads-cite').html(v_url); div.append(divStyle); divStyle.append(divttl); divStyle.append(divd); divStyle.append(cite); img_w.append(div); td.append(img_w); } else { img_w.addClass('sem-widget-ad-icon-passive'); td.append(img_w); } return '' + td.html() + ''; }, dispAdCopy1: function(url, txt, desc, v_url, kw) { var td = $('').attr('align', 'center').addClass('table-first-cell').addClass('ads-wr-open'); var img_w = $('
').addClass('sem-widget-ad-icon'); if (kw.length > 0) { txt = txt.replace(/<\/a>.+/i, ""); 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, ""); img_w.addClass('sem-widget-ad-icon-active'); var div = $('
').addClass('sem-widget-ad-view'); var divStyle = $('
').addClass('sem-widget-ad-view-style'); var divttl = $('').addClass('ads-ln').attr({ 'href': url, 'target': '_blank' }).html(txt); var span = $('').addClass('sem-report-block-ad').html("Ad"); var cite = $('
').addClass('sem-widget-type-ads-domain').append(span).append(v_url); var divd = $('
').addClass('ads-d').html(desc); div.append(divStyle); divStyle.append(divttl); divStyle.append(cite); divStyle.append(divd); img_w.append(div); td.append(img_w); } else { img_w.addClass('sem-widget-ad-icon-passive'); td.append(img_w); } return '' + td.html() + ''; }, dispDomAds: function(domain, adsense, donotcutdomain) { var isIP = false; if (domain instanceof Array) { isIP = domain[0] ? false : true; domain = domain[0] || this.parseDomainFromURL(domain[1]); } var isSetDomain = (domain.length > 0) , ret = ''; if (isSetDomain) { if (typeof donotcutdomain == "undefined" || donotcutdomain == false) { ret += ''; } if (typeof donotcutdomain == "undefined" || donotcutdomain == false) { ret += this.clipString4(domain, 25); } else { ret += domain; } if (typeof donotcutdomain == "undefined" || donotcutdomain == false) { ret += ''; } } return ret; }, dispShoppingAd: function(url, title, price, shop_name, img, kw) { var td = $('').attr('align', 'center').addClass('table-first-cell').addClass('ads-wr-open'); var img_w = $('
').addClass('sem-widget-ad-icon'); if (kw.length > 0) { title = title.replace(/<\/a>.+/i, ""); img_w.addClass('sem-widget-ad-icon-active'); var div = $('
').addClass('sem-widget-ad-view'); div.append($('
').addClass('sem-widget-ad-view-style').html(this.dispShoppingAdBody(url, title, price, shop_name, img))); img_w.append(div); td.append(img_w); } else { img_w.addClass('sem-widget-ad-icon-passive'); td.append(img_w); } return '' + td.html() + ''; }, dispShoppingAdBody: function(url, title, price, shop_name, img) { price = price.replace(';"', ''); var divStyle = $('
').addClass('sem-widget-ad-view-style') , divttl = $('
').addClass('sem-widget-ad-view-title').append($('').addClass('product-title').attr({ 'href': url, 'target': '_blank' }).html(title)) , image = $('
').addClass('sem-widget-ad-view-img').append($('').attr({ 'href': url, 'target': '_blank' }).append($('').attr('src', img).attr('onerror', this.imageError))) , cite = $('
').addClass('sem-widget-type-ads-shop').append(shop_name) , divd = $('
').addClass('ads-d').html(price); var divv = $('
').addClass('sem-widget-ad-view-txt').append(divttl).append(divd).append(cite); var block = $('
').addClass('sem-widget-ad-view-blk').append(image).append(divv); divStyle.append(block); return divStyle.html(); }, dispShoppingAdBodyOverview: function(domain, title, price, shop_name, img) { var divStyle = $('
').addClass('sem-widget-ad-view-style') , divttl = $('
').addClass('sem-widget-ad-view-title').append($('

').addClass('product-title').html(title)) , image = $('

').addClass('sem-widget-ad-view-img').append($('

').append($('').attr('src', img).attr('onerror', this.imageError))) , cite = $('

').addClass('sem-widget-type-ads-shop').append(shop_name) , divd = (price) ? $('
').addClass('ads-d').html(price) : ''; var divv = $('
').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(/&amp;/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(/&amp;/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 '
' + sign + value_diff + '%' + (show_tooltip ? '
' + this.displayDiffDivTooltip(value, value_prev, date, date_prev, postfix) + '
' : '') + '
' }, 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 = '
'; html += '
'; 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

<%= LOCALE.title %>

\n\t\t
\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\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 += "
" + header + "
"; } 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\t\t<% if (typeof options.title_href != \"undefined\") { %>\"><% } %><%= options.title %><% if (typeof options.title_href != \"undefined\") { %><% } %>\n\t\t<% if (typeof data.responce != \"undefined\" && typeof data.responce.get != \"undefined\" && parseInt(data.responce.get(\"total\"), 10) > 0 && data.length > 0) { %>\n\t\t\t(<%= helper.breakToThreeComa(data.responce.get(\"total\")) %>)\n\t\t<% } %>\n\t\t<% if (typeof options.tooltip != \"undefined\") { %>\n\t\t\t
\n\t\t\t\t
\">\n\t\t\t\t\t<%= options.tooltip %>\n\t\t\t\t
\n\t\t\t
\n\t\t<% } %>\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\n\t\t\t\n\t\t<% }); %>\n\t
\n\t\t\t\t\t\">\n\t\t\t\t\t<%= item.point.series.name %>\n\t\t\t\t<%= app.numberFormat(item.point.y, 0, \".\", \",\") %>
\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

<%= LOCALE.title %>

\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 = "
\n\t
\n\t\t
\n\t\t\t<%= helper.ucfirst(item.get(\"title\")) %>\n\t\t
\n\t
\n
" } , 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 += "
"; 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\t\n\t<%= LOCALE.summary_title %>\n\t
<%= LOCALE.adsense_tooltip %>
\n

\n
\n\t\n\t
<%= LOCALE.ads_total_num_of_ads %>
\n
\n\n\n\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\n
<%= LOCALE.ads_publishers_count_title %>\n\t\t\t<% if (model.get(\"publishersCount\") > 0) { %>\n\t\t\t\">\n\t\t\t\t<%= helper.roundNumRank(model.get(\"publishersCount\")) %>\n\t\t\t\n\t\t\t<% } else { %>\n\t\t\t0\n\t\t\t<% } %>\n\t\t
<%= LOCALE.ads_advertisers_count_title %>\n\t\t\t<% if (model.get(\"advertisersCount\") > 0) { %>\n\t\t\t\">\n\t\t\t\t<%= helper.roundNumRank(model.get(\"advertisersCount\")) %>\n\t\t\t\n\t\t\t<% } else { %>\n\t\t\t0\n\t\t\t<% } %>\n\t\t
\n<% } %>\n" } , function(module, exports) { module.exports = "<% if (typeof data !== \"undefined\" && data.length) {\nvar model = data.first();\n%>\n
\n\t
\n\t\t
\n\t\t\t\n\t\t\t<%= LOCALE.adsense_title %>\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t<%= helper.roundNumRankFormatted(model.get(\"adsCount\")) %>\n\t\t\t
\n\t\t\t
<%= LOCALE.ads_total_num_of_ads %>
\n\t\t
\n\t
\n\t
<%= LOCALE.adsense_tooltip %>
\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 += "
"; 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\t\">\n\t\t<%= LOCALE.summary_title %>\n\t\t
<%= LOCALE.tooltip %>
\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
\"><%= sign + model.get(\"traffic_diff\") %>%
\n\t\t
\n\t\t
<%= LOCALE.traffic %>
\n\t
\n\n\t\n\t\t<% if (MIDDLE_WARE.type == 'organic') { %>\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t<% } %>\n\t\t\n\t\t<%\tsign = model.get(\"keywords_diff\") > 0 ? \"+\" : \"\";\n\t\t\tcssClass = model.get(\"keywords_diff\") > 0 ? 'positive' : (model.get(\"keywords_diff\") == 0 ? \"\" : 'negative'); %>\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t<%\tsign = model.get(\"traffic_price_diff\") > 0 ? \"+\" : \"\";\n\t\t\tcssClass = model.get(\"traffic_price_diff\") > 0 ? 'positive' : (model.get(\"traffic_price_diff\") == 0 ? \"\" : 'negative'); %>\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
<%= LOCALE.rank %>\n\t\t\t\t\">\n\t\t\t\t\t<%= helper.roundNumRank(model.get(\"rank\")) %>\n\t\t\t\t\n\t\t\t
<%= LOCALE.keywords %>\n\t\t\t\t\">\n\t\t\t\t\t<%= helper.roundNumRank(model.get(\"keywords\")) %>\n\t\t\t\t\n\t\t\t\n\t\t\t\t
\"><%= sign + model.get(\"keywords_diff\") %>%
\n\t\t\t
<%= LOCALE.traffic_cost %>\n\t\t\t\t\">\n\t\t\t\t\t<%= helper.formatPriceRoundNum(model.get(\"traffic_price\"), MIDDLE_WARE.db_currency) %>\n\t\t\t\t\n\t\t\t\n\t\t\t\t
\"><%= sign + model.get(\"traffic_price_diff\") %>%
\n\t\t\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\t
\n\t\t\t\t
\n\t\t\t\t\t\">\n\t\t\t\t\t<%= LOCALE.title %>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t<%= helper.roundNumRankFormatted(model.get(\"traffic\")) %>\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\"><%= sign + model.get(\"traffic_diff\") %>%
\n\t\t\t\t\t
\n\t\t\t\t\t
<%= LOCALE.traffic %>
\n\t\t\t\t
\n\t\t\t
\n\t\t\t
<%= LOCALE.tooltip %>
\n\t\t
\n\t\t\n<%\t} %>" } , function(module, exports) { module.exports = "

\">\n\t\">\n\t<%= LOCALE.summary_title %>\n\t
<%= LOCALE.tooltip %>
\n

\n
\n\t

<%= LOCALE.nothing_found_title %>

\n\t<%= LOCALE.nothing_found_text %>\n\n\t
\n\t\t

<%= LOCALE.nothing_found_tracking_text %>

\n\t\t\n\t\t\tGo to Position Tracking\n\t\t\n\t\t
\n\t\t\t
<%= LOCALE.go_to_tracking_tooltip %>
\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__(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 += "
"; 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\t\n\t\t<%= LOCALE.summary_title %>\n\t\t
<%= LOCALE.backlinks_tooltip %>
\n\t

\n\t\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
<%= LOCALE.ref_domains %>\n\t\t\t\t:<%= MIDDLE_WARE.target_type %>\" data-test-domain-overview-refdomains-count>\n\t\t\t\t\t<%= helper.roundNumRank(model.get(\"ref_domains\")) %>\n\t\t\t\t\n\t\t\t
<%= LOCALE.ref_ips %>\n\t\t\t\t:<%= MIDDLE_WARE.target_type %>\" data-test-domain-overview-refips-count>\n\t\t\t\t\t<%= helper.roundNumRank(model.get(\"ref_ips\")) %>\n\t\t\t\t\n\t\t\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\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t<%= LOCALE.backlinks_title %>\n\t\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t<%= helper.roundNumRankFormatted(model.get(\"backlinks\")) %>\n\t\t\t\t
\n\t\t\t\t
<%= LOCALE.total %>
\n\t\t\t
\n\t\t
\n\t\t
<%= LOCALE.backlinks_tooltip %>
\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\t
\n\t\t

\n\t\t\t\n\t\t\t\" onclick=\"<%= helper.getGAEventDispatcher('Click widget title')%>\">\n\t\t\t\t<%= LOCALE.ta_engagement_title %>\n\t\t\t\n\n\t\t\t
\n\t\t\t\t<%= LOCALE.ta_engagement_tooltip %>\n\t\t\t
\n\t\t

\n\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t<%= LOCALE.ta_engagement_db_global %>\n\t\t\t<%= helper.formatDate(data.displayDate, 'MMM YYYY') %>\n\n\t\t\t
\n\t\t\t\t<%= LOCALE.ta_engagement_db_global_tooltip %>\n\t\t\t
\n\t\t
\n\t
\n\n\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\n\n\t\t\t\t\n\n\n\t\t\t\t\n\n\t\t\t\t\n\t\t\t\n\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t<%= LOCALE.ta_engagement_metric_ppv %>\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t\" class=\"cell-metric-value\" onclick=\"<%= helper.getGAEventDispatcher('Click Pages per visit')%>\">\n\t\t\t\t\t\t\t<%= helper.roundValue(data.totalPagesPerVisit) %>\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t\">\n\t\t\t\t\t\t\t<%= helper.getSign(data.totalPagesPerVisitDiff) + helper.convertToPercent(data.totalPagesPerVisitDiff) %>\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t<%= LOCALE.ta_engagement_metric_avd %>\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t\" class=\"cell-metric-value\" onclick=\"<%= helper.getGAEventDispatcher('Click Avg. visit duration')%>\">\n\t\t\t\t\t\t\t<%= helper.formatTime(data.totalAvgVisitDuration) %>\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t\">\n\t\t\t\t\t\t\t<%= helper.getSign(data.totalAvgVisitDurationDiff) + helper.convertToPercent(data.totalAvgVisitDurationDiff) %>\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t<%= LOCALE.ta_engagement_metric_br %>\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t\" class=\"cell-metric-value\" onclick=\"<%= helper.getGAEventDispatcher('Click Bounce rate')%>\">\n\t\t\t\t\t\t\t<%= helper.convertToPercent(data.totalBounceRate) %>\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t\">\n\t\t\t\t\t\t\t<%= helper.getSign(data.totalBounceRateDiff) + helper.convertToPercent(data.totalBounceRateDiff) %>\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t
\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] %>>\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\t\t<% _.each(data.categories, function(category) { %>\n\t\t\t\t\t\t
  • \n\t\t\t\t\t\t\t<%= category.ratio %>%\n\t\t\t\t\t\t\t\"><%= LOCALE[\"domain_Ca_\" + category.id] %>\n\t\t\t\t\t\t
  • \n\t\t\t\t\t<% }) %>\n\t\t\t\t\t<% if (data.other) { %>\n\t\t\t\t\t
  • \n\t\t\t\t\t\t<%= data.other.ratio %>%\n\t\t\t\t\t\t<%= LOCALE.other %>\n\t\t\t\t\t
  • \n\t\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 = "
\n\t<% if (databases[0]) { %>\n\t<%= CONF.LOCALE.other_databases %> <%= CONF.MIDDLE_WARE.date_prefix %>/info/<%= CONF.MIDDLE_WARE.domain_id %>\"><%= databases[0] %> <%= CONF.MIDDLE_WARE['database_list'][databases[0]]['sel'] %>\n\t<% } %>\n\t<% if (databases.length > 1) { %>\n\t\tand\n\t\t<% if (databases.length > 2) { %>\n\n\t\t\t
\n\t\t\t\t
<%= databases.length - 1 %> more
\n\t\t\t\t\n\t\t\t
\n\n\t\t<% } else { %>\n\t\t\t<%= CONF.MIDDLE_WARE.date_prefix %>/info/<%= CONF.MIDDLE_WARE.domain_id %>\"><%= databases[1] %> <%= CONF.MIDDLE_WARE['database_list'][databases[1]]['sel'] %>\n\t\t<% } %>\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__(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 += "
" + header + "
"; } ret += "
"; 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
\"><%= sign + model.get(\"branded_diff\") %>%
\n\t\t
\n\t\t
<%= LOCALE.traffic %>
\n\t
\n\t
\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
<%= LOCALE.branded %>\n\t\t\t\t\n\t\t\t\t\t\">\n\t\t\t\t\t\t<%= helper.roundNumRank(model.get(\"keyword_branded\")) %>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\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 "

" + "<%= options.title %>" + "<%= (options.tooltip) ? '
' + options.tooltip + '
' : '' %>" + "

"; } }, 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__)); } ]) }); ;