Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (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 = '<iframe width="' + this.video.width + '" height="' + this.video.height + '" src="//www.youtube.com/embed/' + URL.params.v + '?rel=0" frameborder="0" allowfullscreen></iframe>';
- 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 "<td>0</td>";
- domain_id = domain_id == "" ? "" : domain_id;
- var a_total_ads = "<a title = \"" + title_total + "\" " + "href =\"/analytics/da/cross/" + domain_id + "?advertiserDomain=" + domain_id + "&publisherDomain=" + domain + "&detailedName=_textAds\" >" + total_ads + "</a>";
- if (text_ads == "0") {
- var a_text_ads = "0%";
- } else {
- var a_text_ads = "<a title = \"" + title_text_ads + "\" " + "href =\"/analytics/da/cross/" + domain_id + "?advertiserDomain=" + domain_id + "&publisherDomain=" + domain + "&detailedName=_textAds\" >" + text_ads + "%</a>";
- }
- if (media_ads == "0") {
- var a_media_ads = "0%";
- } else {
- var a_media_ads = "<a title = \"" + title_media_ads + "\" " + "href =\"/analytics/da/cross/" + domain_id + "?advertiserDomain=" + domain_id + "&publisherDomain=" + domain + "&detailedName=_textAds\" >" + media_ads + "%</a>";
- }
- if (typeof sort != "undefined") {
- sort = sort.indexOf("ads_count") == -1 ? "" : "sem-widget-sorted-td";
- } else {
- sort = "";
- }
- if (typeof show_percent == "undefined") {
- var ret = "<td class = \"da-table-num-ads " + sort + (typeof className != 'undefined' ? ' ' + className : '') + "\">" + a_total_ads + "</td>";
- } else {
- var ret = "<td class = \"da-table-num-ads " + sort + "\">" + "<div style=\"float:right;\"><div style=\"float:left;\"" + sort + ">" + "</div><div style=\"float:left; width:50px\"" + sort + ">" + a_text_ads + "</div><div style=\"float:left; width:40px\"" + sort + "><div style =\"text-align:left; padding-left:10px\">" + a_media_ads + "</div><div></td>";
- }
- return ret;
- },
- dispAdsDomainPub: function(domain) {
- var ret = "<td style = 'min-width:180px; width:200px; text-align:left'>";
- if (domain.length > 0) {
- ret += '<nobr><a style="margin-right: 3px;" href="http://' + domain + '" target="_blank" title="' + domain + '"><img src="' + app.conf.MEDIA_URL + '/images/url_icon.gif" border="0" /></a>';
- ret += '<a href="/info/' + domain + '+(by+adsense)">' + domain + '</a>';
- } else {
- ret += this.displayLimits();
- }
- ret += "</td>"
- return ret;
- },
- dispAdsDomainAdv: function(domain) {
- var ret = "<td style = 'min-width:180px; width:200px; text-align:left'>";
- if (domain.length > 0) {
- ret += '<nobr><a style="margin-right: 3px;" href="http://' + domain + '" target="_blank" title="' + domain + '"><img src="' + app.conf.MEDIA_URL + '/images/url_icon.gif" border="0" /></a>';
- ret += '<a href="/info/' + domain + '+(by+adsense)">' + domain + '</a>';
- } else {
- ret += this.displayLimits();
- }
- ret += "</td>"
- return ret;
- },
- dispAdsText: function(title, text, visible_url) {
- var ret = "<td style = 'width:250px; text-align:left'>";
- if (title.length > 0) {
- ret += '<p><b>' + title + '</b></p><p>' + text + '</p><p>' + visible_url + '</p>';
- } else {
- ret += this.displayLimits();
- }
- ret += "</td>"
- return ret;
- },
- dispAdsMedia: function(media_url_id, media_url, media_type) {
- var ret = "<td style='width:200px; border: 0'><center>";
- if (media_url_id.length > 0) {
- if (media_type == "image") {
- ret += '<div style="width:120px; height: 120px; overflow: hidden"><img im=[im] src="' + media_url + '"></img></div>';
- } else if (media_type == "flash") {
- ret += '\
- <div id="youtubeplayer-1" style="width:120px; height: 120px;" fl=[fl]>\
- <object width="120px" height="120px">\
- <param name="wmode" value="transparent" />\
- <param name="movie" value="' + media_url + '"></param>\
- <param name="allowFullScreen" value="true"></param>\
- <param name="allowscriptaccess" value="always"></param>\
- <embed src="' + media_url + '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="120px" height="120px"></embed>\
- </object>\
- </div>';
- }
- } else {
- ret += this.displayLimits();
- }
- ret += "</center></td>"
- return ret;
- },
- dispAdsLandings: function(target_url) {
- var ret = "<td style='width:350px; text-align:left'>";
- if (target_url.length > 0) {
- ret += '<p title = "' + target_url + '">';
- ret += '<nobr><a class="sem-widget-url-img" href="' + target_url + '" target="_blank" rel="nofollow noopener noreferrer" title="' + target_url + '"></a> ';
- if (target_url.length >= 50) {
- ret += target_url.substring(0, 50) + '...';
- } else {
- ret += target_url;
- }
- ret += '</p>';
- } else {
- ret += this.displayLimits();
- }
- ret += "</center></td>"
- 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('<a class="report_links_text" href="' + tmp_zurl + '/info/' + path + type + '">' + tip + '</a>');
- }
- return '<div class="sp04"> </div><div class="sp05">' + num + '</div>';
- } else if (str.length > 3 && str.length < 7) {
- r_num = num / 1000;
- $('#' + contid).html('<a class="report_links_text" href="' + tmp_zurl + '/info/' + path + type + '">' + tip + '</a>');
- return '<div class="sp04">k</div><div class="sp05">' + r_num.toFixed(1) + '</div>';
- } else {
- r_num = num / 1000000;
- $('#' + contid).html('<a class="report_links_text" href="' + tmp_zurl + '/info/' + path + type + '">' + tip + '</a>');
- return '<div class="sp04">m</div><div class="sp05">' + r_num.toFixed(1) + '</div>';
- }
- },
- 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 = '<td';
- if (first == 1) {
- ret += ' class="sem-widget-table-first-col left"';
- }
- if (!isSetDomain) {
- ret += ' align="center"';
- }
- ret += '>';
- if (isSetDomain) {
- if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
- ret += '<nobr>';
- }
- ret += '<a href="http://' + domain + '/" class="sem-widget-url-img" title="' + domain + '" target="_blank" rel="nofollow noopener noreferrer"></a> ';
- if (!isIP) {
- ret += '<a class="sem-widget-url-cell" href="' + db_pref + app.conf.DB_DATE_PREFIX + '/info/' + domain + href + '" title="' + domain + '"' + target + '>';
- }
- if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
- ret += this.clipString4(domain, 25);
- } else {
- ret += domain;
- }
- if (!isIP) {
- ret += '</a> ';
- }
- if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
- ret += '</nobr>';
- }
- } else {
- ret += this.displayLimits();
- }
- ret += '</td>';
- 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 = '<td';
- if (addClass) {
- ret += ' class="' + addClass + '"';
- }
- if (!isSetDomain) {
- ret += ' align="center"';
- }
- ret += '>';
- if (isSetDomain) {
- if (!isIP) {
- ret += '<a href="' + db_pref + app.conf.DB_DATE_PREFIX + '/info/' + domain + href + '" title="' + domain + '"' + target + '>';
- }
- if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
- ret += this.clipString4(domain, 25);
- } else {
- ret += domain;
- }
- if (!isIP) {
- ret += '</a> ';
- }
- } else {
- ret += this.displayLimits();
- }
- ret += '</td>';
- return ret;
- },
- dispSearchEngine: function(engine, donotcut, addClass) {
- var isSetNetwork = (engine.length > 0)
- , ret = '<td';
- if (addClass) {
- ret += ' class="' + addClass + '"';
- }
- if (!isSetNetwork) {
- ret += ' align="center"';
- }
- ret += '>';
- if (isSetNetwork) {
- if (typeof donotcut == "undefined" || donotcut == false) {
- ret += this.clipString4(engine, 25);
- } else {
- ret += engine;
- }
- } else {
- ret += this.displayLimits();
- }
- ret += '</td>';
- return ret;
- },
- dispSocialNetwork: function(network, donotcut, addClass) {
- var isSetNetwork = (network.length > 0)
- , ret = '<td';
- if (addClass) {
- ret += ' class="' + addClass + '"';
- }
- if (!isSetNetwork) {
- ret += ' align="center"';
- }
- ret += '>';
- if (isSetNetwork) {
- if (typeof donotcut == "undefined" || donotcut == false) {
- ret += this.clipString4(network, 25);
- } else {
- ret += network;
- }
- } else {
- ret += this.displayLimits();
- }
- ret += '</td>';
- return ret;
- },
- dispTrafficKeywordCell: function(keyword, addClass, undefinedKeyword, undefinedTooltip) {
- var isSetKeyword = (keyword.length > 0)
- , ret = '<td';
- if (addClass) {
- ret += ' class="' + addClass + '"';
- }
- if (!isSetKeyword) {
- ret += ' align="center"';
- }
- ret += '>';
- if (isSetKeyword) {
- ret += this.dispTrafficKeyword(keyword[0], undefinedKeyword, undefinedTooltip);
- } else {
- ret += this.displayLimits();
- }
- ret += '</td>';
- return ret;
- },
- dispTrafficKeyword: function(keyword, undefinedKeyword, undefinedTooltip) {
- if (keyword === '') {
- keyword = '<span style="font-style: italic;" ' + (undefinedTooltip ? ' title="' + undefinedTooltip + '"' : '') + '>' + undefinedKeyword + '</span>';
- } else if (keyword.length > 50) {
- keyword = "<span title='" + keyword + "'>" + this.clipString4(keyword, 50) + "</span>";
- }
- 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 = '<td';
- if (addClass) {
- ret += ' class="' + addClass + '"';
- }
- if (!isSetDomain) {
- ret += ' align="center"';
- }
- ret += '>';
- if (isSetDomain) {
- if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
- ret += this.clipString4(domain, 25);
- } else {
- ret += domain;
- }
- } else {
- ret += this.displayLimits();
- }
- ret += '</td>';
- return ret;
- },
- displayLink: function(domain, href, display_text, db_pref_custom, donotcutdomain, target) {
- var isIP = false;
- if (domain instanceof Array) {
- isIP = domain[0] ? false : true;
- domain = domain[0] || this.parseDomainFromURL(domain[1]);
- }
- var display_text = (typeof display_text != "undefined" && display_text) ? display_text : domain;
- var db_pref = (typeof db_pref_custom != "undefined" && db_pref_custom) ? db_pref_custom : app.conf.DB_PREFIX;
- var target = (typeof target != "undefined" && target) ? ' target="' + target + '"' : '';
- href = (typeof href != "undefined" && href) ? href : "";
- var isSetDomain = (domain.length > 0)
- , ret = '';
- if (isSetDomain) {
- if (!isIP) {
- ret += '<a href="' + db_pref + app.conf.DB_DATE_PREFIX + '/info/' + domain + href + '" title="' + display_text + '"' + target + '>';
- }
- if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
- ret += this.clipString4(display_text, 25);
- } else {
- ret += display_text;
- }
- if (!isIP) {
- ret += '</a>';
- }
- }
- 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 = '<td align="right" class="right" style="white-space: nowrap !important;">';
- if (typeof value == "undefined" || value == null) {
- ret += '-';
- } else if (parseInt(value) == 0) {
- ret += value;
- } else {
- ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + domain + '+(by+organic)">' + value + '</a>';
- }
- ret += '</td>';
- return ret;
- },
- dispAd: function(value, domain) {
- var ret = '<td align="right" class="right" style="white-space: nowrap !important;">';
- if (typeof value == "undefined" || value == null) {
- ret += '-';
- } else if (parseInt(value) == 0) {
- ret += value;
- } else {
- ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + domain + '+(by+adwords)">' + value + '</a>';
- }
- ret += '</td>';
- return ret;
- },
- dispTr: function(traffic, previousTraffic, sorted, addClass) {
- var ret = '<td align="right" style="white-space: nowrap !important;" class="right ';
- if (typeof sorted != "undefined" && sorted) {
- ret += 'sem-widget-sorted-td';
- }
- if (typeof addClass != "undefined" && addClass) {
- ret += ' ' + addClass;
- }
- ret += '">';
- ret += (typeof traffic == "undefined" || traffic == null) ? '-' : traffic;
- if (typeof previousTraffic != "undefined" && previousTraffic != null) {
- ret += ' <span style="font-size:10px; color:#555;">(' + previousTraffic + ')</span>';
- }
- ret += '</td>';
- return ret;
- },
- dispTr1: function(value, previousValue, sorted, ts, cellPosition, searchField, reportType) {
- Date.now = Date.now || function() {
- return +new Date;
- }
- var ret = '<td class="';
- ret += (cellPosition ? cellPosition : 'right') + ' ';
- if (value > 100 && Date.now() - ts * 1000 <= 24 * 3600 * 1000) {
- ret += ' sem-report-super-traffic';
- } else if (typeof sorted != "undefined" && sorted) {
- ret += ' sem-widget-sorted-td';
- }
- ret += '">';
- if (value > 100 && Date.now() - ts * 1000 <= 24 * 3600 * 1000) {
- ret += '<div class="sem-report-with-tooltip">';
- }
- if (typeof searchField != "undefined" && searchField) {
- ret += '<a class="sem-widget-cell-link" href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + encodeURIComponent(searchField) + '+' + reportType + '">';
- }
- ret += (typeof value == "undefined" || value == null) ? '-' : this.dispTraffic(value);
- if (typeof searchField != "undefined" && searchField) {
- ret += "</a>";
- }
- if (typeof previousValue != "undefined" && previousValue != null) {
- ret += ' <span style="font-size:10px; color:#555;">(' + previousValue + ')</span>';
- }
- if (value > 100 && Date.now() - ts * 1000 <= 24 * 3600 * 1000) {
- ret += '<div class="sem-report-tooltip-right">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%.</div></div>';
- }
- ret += '</td>';
- return ret;
- },
- dispTraffic: function(traffic) {
- if (Math.ceil((parseFloat(traffic) * 100) / 100) === 0) {
- return "< 0.01";
- }
- return traffic;
- },
- dispTrBar: function(traffic) {
- var ret = '<td>';
- ret += '<div class="sem-report-bar" title="' + (traffic == 0 ? '< 0.01' : traffic) + '%"><div class="sem-report-bar-fill" style="width: ' + traffic + '%;"></div></div>';
- ret += '</td>';
- return ret;
- },
- dispTc: function(costs, previousCosts, sorted, addClass) {
- var ret = '<td align="right" style="white-space: nowrap !important;" class="right ';
- if (typeof sorted != "undefined" && sorted) {
- ret += 'sem-widget-sorted-td';
- }
- if (typeof addClass != "undefined" && addClass) {
- ret += ' ' + addClass;
- }
- ret += '">';
- ret += (typeof costs == "undefined" || costs == null) ? '-' : costs;
- if (typeof previousCosts != "undefined" && previousCosts != null) {
- ret += ' <span style="font-size:10px; color:#555;">(' + previousCosts + ')</span>';
- }
- ret += '</td>';
- 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 = '<td align="right" style="white-space: nowrap !important;"';
- ret += 'class="' + this._cellClass(sorted, addClass) + '">';
- ret += (typeof value == "undefined" || value == null) ? '-' : value;
- ret += '</td>';
- 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 = '<td align="right" style="white-space: nowrap !important;" class="right ';
- if (typeof sorted != "undefined" && sorted) {
- ret += ' sem-widget-sorted-td';
- }
- if (typeof additionalClass != "undefined" && additionalClass) {
- ret += ' ' + additionalClass;
- }
- ret += '">';
- ret += (typeof value == "undefined" || value == null) ? '-' : value;
- if (typeof previousValue != "undefined" && previousValue != null) {
- ret += ' <span style="font-size:10px; color:#555;">(' + previousValue + ')</span>';
- }
- ret += '</td>';
- return ret;
- },
- dispTextValue: function(value, sorted) {
- var ret = '<td style="text-align: left; white-space: nowrap !important;"';
- if (typeof sorted != "undefined" && sorted) {
- ret += ' class="sem-widget-sorted-td"';
- }
- ret += ">";
- ret += (typeof value == "undefined" || value == null) ? "" : value;
- ret += "</td>";
- return ret;
- },
- dispLinkValue: function(value, sorted, searchField, reportType) {
- var ret = '<td style="text-align: center; white-space: nowrap !important;"';
- if (typeof sorted != "undefined" && sorted) {
- ret += ' class="sem-widget-sorted-td"';
- }
- ret += ">";
- if (typeof searchField != "undefined" && searchField) {
- ret += '<a class="sem-widget-cell-link" href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + encodeURIComponent(searchField) + '+' + reportType + '">';
- }
- if (typeof value != "undefined" && parseInt(value)) {
- ret += this.breakToThreeComa(value);
- }
- if (typeof searchField != "undefined" && searchField) {
- ret += '</a>';
- }
- ret += "</td>";
- 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 = '<td';
- if (typeof sorted != "undefined" && sorted) {
- td += ' class="sem-widget-progress-bar-cell sem-widget-progress-bar-cell-comp sem-widget-sorted-td"';
- } else {
- td += ' class="sem-widget-progress-bar-cell sem-widget-progress-bar-cell-comp"';
- }
- if (domain.length > 0) {
- if (relevance < 0) {
- td += '>N/A</td>';
- } else {
- td += '><div class="sem-widget-progress-bar" title="' + Math.round(calculatedRelevance) + '%"><div style="width: ' + calculatedRelevance + '%;"></div></div></td>';
- }
- } else {
- td += '>' + this.displayLimits() + '</td>';
- }
- 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 = '<td class="right cl-display-com-keyword';
- if (typeof sorted != "undefined" && sorted) {
- ret += 'sem-widget-sorted-td';
- }
- ret += '"';
- if (domain.length > 0) {
- ret += 'align="right">';
- ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + main_domain + '+*+' + domain + '+(by+' + request_type + ')">' + this.calcRound3(kws) + '</a>';
- } else {
- ret += 'align="center">';
- ret += this.displayLimits();
- }
- ret += "</td>";
- 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 '<a class="sem-widget-url-img" href="' + url + '" target="_blank" title="' + url + '"></a>';
- }
- 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) ? '<nobr>' : '';
- if (url == v_url) {
- var adw_key = 0;
- var add_v_url = '';
- if (!noClip)
- ret += '<a class="sem-widget-url-img" href="' + url + '" target="_blank" title="' + url + '"></a>';
- if (!isIP) {
- ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + encodeURIComponent(add_v_url + v_url) + '" title="' + v_url + '">';
- }
- ret += (noClip) ? v_url : this.clipString3(v_url, 30, adw_key);
- if (!isIP) {
- ret += '</a>';
- }
- } 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 += '<a class="sem-widget-url-img" href="' + (url) + '" target="_blank" title="' + url + '"></a>';
- if (!isIP) {
- ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + encodeURIComponent(add_v_url + v_url) + '" title="' + v_url + '">';
- }
- ret += (noClip) ? v_url : this.clipString3(this.replaceLG(v_url), 25, adw_key);
- if (!isIP) {
- ret += '</a>';
- }
- }
- ret += (!wordWrap) ? '</nobr>' : '';
- } else {
- if (url != v_url && app.conf.UPLIM_ADW.length > 0) {
- ret += '<span class="sem-widget-small-note">' + app.conf.UPLIM_ADW + '</span>';
- } 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) ? '<nobr>' : '';
- if (url == v_url) {
- var adw_key = 0;
- var add_v_url = '';
- if (!noClip)
- ret += '<a class="sem-widget-url-img" href="' + url + '" target="_blank" title="' + url + '"></a>';
- if (!isIP) {
- ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + encodeURIComponent(add_v_url + v_url) + '" title="' + v_url + '">';
- }
- ret += (noClip) ? v_url : this.clipUrl(v_url, 150);
- if (!isIP) {
- ret += '</a>';
- }
- } 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 += '<a class="sem-widget-url-img" href="' + (url) + '" target="_blank" title="' + url + '"></a>';
- if (!isIP) {
- ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + encodeURIComponent(add_v_url + v_url) + '" title="' + v_url + '">';
- }
- ret += (noClip) ? v_url : this.clipUrl(this.replaceLG(v_url), 150);
- if (!isIP) {
- ret += '</a>';
- }
- }
- ret += (!wordWrap) ? '</nobr>' : '';
- } else {
- if (url != v_url && app.conf.UPLIM_ADW.length > 0) {
- ret += '<span class="sem-widget-small-note">' + app.conf.UPLIM_ADW + '</span>';
- } else {
- ret += this.displayLimits();
- }
- }
- return ret;
- },
- dispKwPos: function(Po, Pp, sorted) {
- var ret = '<td align="right" style="white-space:nowrap!important;"';
- if (typeof sorted != "undefined" && sorted) {
- ret += ' class="sem-widget-sorted-td"';
- }
- ret += '>';
- ret += (Po == undefined || Po == null || Po == '0') ? '-' : Po;
- ret += '<span class="pp-v2">';
- if (Pp == undefined || Pp == null || Pp == '0') {
- ret += ' ';
- } else {
- ret += '(' + Pp + ')';
- }
- ret += '</span></td>';
- return ret;
- },
- dispAdwordsBlockWithoutLink: function(bl) {
- var title;
- switch (bl) {
- case '***BOTTOM***':
- bl = 'bottom';
- title = "Bottom";
- break;
- case '***SIDE***':
- bl = 'side';
- title = "Side";
- break;
- case '***TOP***':
- bl = 'top';
- title = "Top";
- break;
- default:
- return '-';
- }
- return '<i class="sem-report-adwords-block sem-report-adwords-block-' + bl + '" title="' + title + '"></i>';
- },
- dispAdwordsBlock: function(bl, kw, is_adwords, domain, position, timestamp, ignore_date_prefix) {
- var a = '<a ', title;
- switch (bl) {
- case '***BOTTOM***':
- bl = 'bottom';
- title = "Bottom";
- break;
- case '***SIDE***':
- bl = 'side';
- title = "Side";
- break;
- case '***TOP***':
- bl = 'top';
- title = "Top";
- break;
- default:
- return '-';
- }
- if (kw.length > 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 += '><i class="sem-report-adwords-block sem-report-adwords-block-' + bl + '" title="' + title + '"></i></a>';
- return a;
- },
- dispKwPosHistorical: function(Po, Pp, sorted, allowHistorical) {
- var ret = '<td class="sem-widget-po-td';
- if (typeof sorted != "undefined" && sorted) {
- ret += ' sem-widget-sorted-td';
- }
- ret += ' nowrap">';
- ret += '<span class="sem-widget-po-span sem-widget-po-value">';
- ret += (Po == undefined || Po == null || Po == '0') ? '-' : Po;
- ret += '</span>';
- ret += '<span class="sem-widget-po-span sem-widget-pp-value">';
- if (Pp == undefined || Pp == null || Pp == '0') {
- ret += ' ';
- } else {
- ret += '(' + Pp + ')';
- }
- ret += '</span></td>';
- return ret;
- },
- dispPosDif: function(Pd, sorted) {
- var ret = '<td align="right" style="white-space:nowrap!important;';
- if (Pd > 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 += '</td>';
- return ret;
- },
- dispPositions: function(Ps, index, sorted) {
- var ret = '<td align="right" style="white-space: nowrap !important;"';
- if (typeof sorted != "undefined" && sorted) {
- ret += ' class="sem-widget-sorted-td"';
- }
- ret += '>';
- ret += Ps.split(',')[index];
- ret += '</td>';
- return ret;
- },
- prependZero: function(value) {
- return value < 10 ? "0" + value : value;
- },
- dispTimestamp: function(timestamp) {
- var date, ret = "-";
- if (timestamp) {
- date = new Date(parseInt(timestamp, 10) * 1000);
- ret = this.prependZero(date.getUTCHours()) + ":" + this.prependZero(date.getUTCMinutes()) + ":" + this.prependZero(date.getUTCSeconds()) + " " + this.prependZero(date.getUTCDate()) + "." + this.prependZero(date.getUTCMonth() + 1) + "." + date.getUTCFullYear();
- }
- return ret;
- },
- dispHumanDate: function(date) {
- if (!date) {
- return '-';
- }
- date = parseInt(date, 10);
- 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 if (difference < 30 * 24 * 60 * 60) {
- date = new Date(date * 1000);
- return date.getDate() + ' ' + app.conf.MONTH_SHORT_NAMES[date.getMonth()] + " " + date.getFullYear();
- } else if (difference > 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 += '<td align="right" style="white-space:nowrap!important;" class="right ';
- if (typeof sorted != "undefined" && sorted) {
- ret += 'sem-widget-sorted-td';
- }
- if (typeof addClass != "undefined" && addClass) {
- ret += ' ' + addClass;
- }
- ret += '">' + ((Nq) ? this.breakToThreeComa(Nq) : 'n/a') + '</td>';
- }
- return ret;
- },
- dispCvHistory: function(cv, sorted) {
- return '<td class="right ' + (typeof sorted != "undefined" ? 'sem-widget-sorted-td' : '') + '">' + cv + '</td>';
- },
- dispRkHistory: function(Rk, Hs, sorted) {
- var ret = "";
- if (typeof Hs[0] != "undefined") {
- var ret = '<td align="right" style="white-space:nowrap!important;" class="sem-widget-offset-col';
- if (typeof sorted != "undefined" && sorted) {
- ret += ' sem-widget-sorted-td';
- }
- ret += '">' + ((Rk) ? this.breakToThreeComa(Rk) : 'n/a') + '</td>';
- }
- 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 += '<td align="right" style="white-space:nowrap!important;" class="right ';
- if (typeof sorted != "undefined" && sorted) {
- ret += 'sem-widget-sorted-td';
- }
- ret += '">' + ((Cp != "") ? Cp : 'n/a') + '</td>';
- }
- return ret;
- },
- dispTrHistory: function(Tr, volumes, sorted, addClass) {
- var hasVolume = true;
- if (volumes && typeof volumes[0] != "undefined" && !volumes[0]["Nq"]) {
- hasVolume = false;
- }
- var ret = '<td align="right" style="white-space:nowrap!important;" class="right ';
- if (typeof sorted != "undefined" && sorted) {
- ret += 'sem-widget-sorted-td';
- }
- if (typeof addClass != "undefined" && addClass) {
- ret += ' ' + addClass;
- }
- ret += '">' + ((Tr && hasVolume) ? Tr : 'n/a') + '</td>';
- 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 class="' + (i == (_.values(positions).length - 1) ? 'sem-widget-offset-col ' : '') + 'sem-widget-adwords-history-td';
- if (Po > 0) {
- td += ' sem-widget-adwords-history-td-' + ((limit) ? " limit" : Po);
- td += '" rel="' + (_.values(positions).length - i) + '">';
- td += Po;
- } else if (Po < 0) {
- td += '-empty"><div class="sem-widget-adwords-history-td-na"';
- if (typeof title != 'undefined') {
- td += ' title="' + title + '"';
- }
- td += '> </div>';
- } else {
- td += '-empty"><div> </div>';
- }
- td += '</td>';
- ret = td + ret;
- i++;
- }
- return ret;
- },
- dispAds: function(ads, new_design) {
- var previousMonth = 0;
- spacerMonth = 0,
- month = 0,
- year = 0,
- _this = this;
- var length = _.values(ads).length
- , ret = '<tr class="sem-widget-adwords-history-ads-tr">' + '<td colspan="' + (length + 5) + '">' + '<div class="sem-widget-adwords-history-ads-container-0">' + '<div class="sem-widget-adwords-history-ads-container-1">' + '<div class="sem-widget-adwords-history-ads-container">';
- _.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 += '<div class="sem-widget-adwords-history-ad">' + '<div class="sem-widget-adwords-history-ad-container sem-widget-adwords-history-ad-spacer">' + '<div class="sem-widget-adwords-history-ad-date-empty">' + ((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) + '</div>' + '<div class="sem-widget-adwords-history-ad-spacer-content"> </div>' + '</div></div>';
- }
- index = parseInt(index, 10) + 1;
- item["Ds"] = item["Ds"].replace(/<table[^>]*>(.+)?<\/table>/ig, "");
- item["Ds"] = item["Ds"].replace(/<span[^>]*>(.+)?<\/span>/ig, "");
- item["Ds"] = item["Ds"].replace(/<a[^>]*>(.+)?<\/a>/ig, "");
- item["Ds"] = item["Ds"].replace(/ $/ig, "");
- item["Ds"] = item["Ds"].replace(/<br>$/ig, "");
- item["Ds"] = item["Ds"].replace(/<div[^>]*>/ig, "");
- item["Ds"] = item["Ds"].replace(/<\/div>/ig, "");
- if (item["Cp"] == "") {
- item["Cp"] = (item["Nq"] == "" ? "n/a" : "0.00");
- }
- ret += '<div class="sem-widget-adwords-history-ad sem-widget-adwords-history-ad-title-' + item["Po"] + ' sem-widget-adwords-history-ad-' + index + '" rel="' + index + '">' + '<div class="sem-widget-adwords-history-ad-container">' + '<div class="sem-widget-adwords-history-ad-date">' + app.conf.MONTH_NAMES[month - 1] + ' ' + year + '</div>' + '<div class="sem-widget-adwords-history-ad-text">';
- if (typeof new_design !== "undefined") {
- ret += '<a href="' + item['Ur'] + '" target="_blank">' + item["Tt"] + '</a>' + '<div class="sem-widget-type-ads-domain" title="' + item['Vu'] + '"><span class="sem-report-block-ad">Ad</span>' + _this.clipString3(item["Vu"], 30, 0) + '</div>' + '<div>' + item["Ds"] + '</div>';
- } else {
- ret += '<div class="ads-ln"><a href="' + item["Ur"] + '" target="_blank">' + item["Tt"] + '</a></div>' + '<div class="ads-d">' + item["Ds"] + '</div>' + '<cite class="ads-cite">' + _this.clipString3(item["Vu"], 30, 0) + '</cite>';
- }
- ret += '</div>' + ((typeof item["Nq"] != "undefined" && typeof item["Cp"] != "undefined") ? '<div class="sem-widget-adwords-history-ad-values"><div>Volume: ' + _this.breakToThreeComa(item["Nq"]) + '; CPC: ' + item["Cp"] + '</div></div>' : '') + '</div></div>';
- spacerMonth = parseInt(item["Dt"].substr(4, 2), 10);
- previousMonth = spacerMonth;
- });
- ret += '<div style="clear: both;"></div></div></div></div></td></tr>';
- return ret;
- },
- dispRoundNum: function(num, addClass) {
- var cellClass = "right";
- if (typeof addClass != "undefined" && addClass) {
- cellClass += ' ' + addClass;
- }
- return '<td class="' + cellClass + '" align="right">' + this.calcRound3(num) + '</td>';
- },
- dispRoundNumWithA: function(num, path, addClass) {
- var cellClass = "right";
- if (typeof addClass != "undefined" && addClass) {
- cellClass += ' ' + addClass;
- }
- var ret = '<td class="' + cellClass + '" align="right">';
- ret += '<a href="' + path + '">' + this.calcRound3(num) + '</a>';
- return ret + '</td>';
- },
- 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 = '<td class="left cl-table-cell_keyword' + ((first == 0) ? ' sem-widget-table-first-col' : '') + '"';
- if (kw.length > 0) {
- ret += '><a href="' + db_pref + app.conf.DB_DATE_PREFIX + '/info/' + kw + href + '"' + target + '>' + this.clipWord(kw, 30) + '</a>';
- } else {
- ret += ' align="center">';
- ret += this.displayLimits();
- }
- ret += "</td>"
- 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 = '<td class="left cl-table-cell_keyword' + ((first == 0) ? ' sem-widget-table-first-col' : '') + '"';
- if (kw.length > 0) {
- ret += '><div class="sem-report-with-tooltip">';
- ret += '<a href="' + db_pref + app.conf.DB_DATE_PREFIX + '/info/' + kw + href + '"' + target + '>' + this.clipWord(kw, 30) + '</a>';
- ret += '<div class="sem-report-tooltip-right cell-tooltip">';
- if (options.locale && options.categories) {
- ret += '<p>' + options.locale.categories + '</p>';
- ret += '<ul style="text-align: left; margin-bottom: 5px">';
- ret += _.map(options.categories, function(value) {
- return '<li>' + options.locale['filters_Ca_' + value] + '</li>';
- }).join('');
- ret += '</ul>';
- }
- if (options.locale && options.serpfeatures) {
- ret += '<p style="white-space:nowrap;">' + options.locale.serp_features + '</p>';
- ret += '<ul style="text-align: left">';
- ret += _.map(options.serpfeatures, function(value) {
- var item = '<li>';
- 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 + '</li>';
- }).join('');
- ret += '</ul>';
- }
- ret += '</div></div>';
- } else {
- ret += ' align="center">';
- ret += this.displayLimits();
- }
- ret += "</td>"
- 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 "<span class='sem-report-counter'><strong " + ho + ">" + ret + "</strong></span>";
- },
- 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[^>]*>(.+)?<\/span>/ig, "");
- text = text.replace(/<a[^>]*>(.+)?<\/a>/ig, "");
- if (text.match(/<table[^>]*>/ig) && !text.match(/<\/table>/ig)) {
- text = '';
- }
- text = text.replace(/<table[^>]*>(.+)?<\/table>/ig, "");
- text = text.replace(/ $/ig, "");
- text = text.replace(/<br>$/ig, "");
- }
- return text;
- },
- dispKeywordDifficulty: function(diff, sorted) {
- var ret = '<td class="sem-widget-kw-diff ';
- if (typeof sorted != "undefined" && sorted) {
- ret += ' sem-widget-sorted-td';
- }
- ret += '">';
- if (diff && diff > 0) {
- ret += diff;
- } else {
- ret += '-';
- }
- ret += '</td>';
- return ret;
- },
- makeTrend: function(trend) {
- var trends = ''
- , foo = '<ul class="trends-chart">';
- if (typeof trend != "undefined" && trend.length != 0) {
- $.each(trend.split(','), function(j, trend_block) {
- trends += '<li class="trend-bg-color" style="height: ' + (trend_block * 20) + 'px;"></li>';
- });
- }
- return '<td class="sem-minwidth-td" style="text-align: center;">' + foo + trends + '</ul></td>';
- },
- dispSource: function(kw, is_adwords, domain, position, timestamp, ignore_date_prefix) {
- var a = '<a class="serp-link" target="_blank" ';
- if (!kw.length) {
- return a + 'data-serp="limit" href="/limit_results/"' + app.conf.ADD_REG_FORM + '> </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 + '"> </a>';
- 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 += '<td align="right" ' + classes + ' title="' + diff + '" style="padding-right:2px;';
- if (difference < 0) {
- if (typeof clipped != "undefined") {
- ret += 'color:#c00;">' + '-' + this.roundNumRankNew((-1 * difference));
- } else {
- ret += 'color:#c00;">' + '-' + this.breakToThreeComa((-1 * difference));
- }
- } else if (difference > 0) {
- if (typeof clipped != "undefined") {
- ret += 'color:#090;">' + this.roundNumRankNew(difference);
- } else {
- ret += 'color:#090;">' + this.breakToThreeComa(difference);
- }
- } else {
- ret += '">' + difference;
- }
- ret += '</td>';
- 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 '<div style="width: 100%; text-align: center; height: 55px;">' + no_trend_data + '</div>';
- else {
- var trend_array = trend.split(",");
- var trind_str = new String('<table cellspacing=0 cellpadding=0 width=100% height=60px><tr>');
- $.each(trend_array, function(j, trend_block) {
- var block_height = trend_block * 60;
- trind_str += '<td valign="bottom" style="border: 0px; margin: 0px; padding: 0px 4px;background-color:#fff; box-shadow:none;">';
- trind_str += '<div style="height: ' + block_height + 'px;" class="big-trend-bg"> </div>';
- trind_str += '</td>';
- });
- return trind_str += '</tr></table>';
- }
- },
- displayCountryFlag: function(country) {
- var title = (typeof geoCountries[country] != 'undefined') ? geoCountries[country] : country
- , ret = '<i title="' + title + '" class="js-copy-class sem-' + country.toLowerCase() + '">' + country.toUpperCase() + '</i>';
- return ret;
- },
- displayDatabaseFlag: function(db) {
- db = _.replace(db, /(bing-|mobile-|-ext)/, '');
- return "<i class='sem-" + db + "'></i>";
- },
- displayRefDomainLink: function(member) {
- if (!member || member.length === 0) {
- var link = jQuery('<a/>').attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM);
- return jQuery("<td/>").append(link).html();
- }
- var cnt = jQuery("<nobr/>")
- , dLink = jQuery("<a/>", {
- 'class': 'sem-widget-url-img',
- 'title': 'http://' + member,
- 'target': '_blank',
- 'href': 'http://' + member
- }).appendTo(cnt)
- , iLink = jQuery("<a/>", {
- '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('<a/>').attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM);
- return jQuery("<td/>").append(link).html();
- }
- return ipAddr;
- },
- displayTLD: function(zone) {
- if (!zone || zone.length === 0) {
- var link = jQuery('<a/>').attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM);
- return jQuery("<td/>").append(link).html();
- }
- return '.' + zone;
- },
- displayCountry: function(country) {
- if (!country || country.length === 0) {
- var link = jQuery('<a/>').attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM);
- return jQuery("<td/>").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 == '<EmptyAnchor>')
- 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 = $('<a/>').attr('href', href).text(this.breakToThreeComa(displayItem));
- return $('<td/>').append(link).html();
- },
- displayBacklinkLink: function(member) {
- var td = $('<td>').addClass('table-first-cell'), c = $('<div>'), t = $('<div>'), u = $('<div>').addClass('backlinks-divlinks'), a = $('<a>'), tl = $('<div>').addClass('backlinks-divlinks'), tla = $('<a>'), stu = $('<span>').addClass('backlinks-tslink-span').text('Target URL: '), ssu = $('<span>').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 style="text-align:left;">' + td.html() + '</td>';
- },
- displayBacklinkLinkSource: function(member) {
- var td = $('<td>').addClass('table-first-cell'), content = $('<div>'), title = $('<div>'), bl_div = $('<div>').addClass('backlinks-divlinks'), anchor = $('<a>'), 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 style="text-align:left;">' + td.html() + '</td>';
- },
- displayBacklinksPagesLink: function(member) {
- var td = $('<td>').addClass('table-first-cell'), c = $('<div>'), t = $('<div>'), u = $('<div>').addClass('backlinks-divlinks'), a = $('<a>'), ssu = $('<span>').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 style="text-align:left;">' + td.html() + '</td>';
- },
- displayBacklinkAnchor: function(member) {
- var td = $('<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 = $('<div>').text(anchorTxt);
- td.append(div).addClass('backlinks-anchors');
- } else {
- td.html(' ');
- }
- return '<td style="text-align:left;">' + td.html() + '</td>';
- },
- displayBacklinkAnchorTarget: function(member) {
- var td = $('<td>').attr('align', 'left')
- , content = $('<div>')
- , bl_div = $('<div>').addClass('backlinks-divlinks')
- , anchor = $('<a>');
- var anchorTxt = member.anchor;
- if (anchorTxt.length > 0) {
- if (anchorTxt.length > 40) {
- anchorTxt = this.strClipOld(anchorTxt, 40, 'right', false, false);
- }
- var div = $('<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 style="text-align:left;">' + td.html() + '</td>';
- },
- displayFormattedAnchor: function(member) {
- if (member == '<EmptyAnchor>') {
- return '<i style="color:#999">Empty Anchor</i>';
- }
- return _.escape(member);
- },
- displayBacklinkRank: function(member) {
- var td = $('<td>').attr('align', 'left');
- if (member.rank || member.rank === 0) {
- var div = $('<div>').text(member.rank);
- td.append(div).addClass('backlinks-anchors');
- } else {
- td.html(' ');
- }
- return '<td style="text-align:left;">' + td.html() + '</td>';
- },
- displayBacklinkExternalLinks: function(member) {
- var td = $('<td>').attr('align', 'right');
- if (member.external_link_num || member.external_link_num === 0) {
- var div = $('<div>').text(member.external_link_num);
- td.append(div).addClass('backlinks-anchors');
- } else {
- td.html(' ');
- }
- return '<td style="text-align:right;">' + td.html() + '</td>';
- },
- displayBacklinkInternalLinks: function(member) {
- var td = $('<td>').attr('align', 'right');
- if (member.internal_link_num || member.internal_link_num === 0) {
- var div = $('<div>').text(member.internal_link_num);
- td.append(div).addClass('backlinks-anchors');
- } else {
- td.html(' ');
- }
- return '<td style="text-align:right;">' + td.html() + '</td>';
- },
- displayBacklinkLastSeenDate: function(member) {
- var td = $('<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 = $('<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 = $('<td>');
- if (!member.nofollow && !member.frame && !member.form && !member.image && !member.sitewide) {
- return '<td style="text-align:center;"> </td>';
- }
- if (member.nofollow) {
- var div = $('<div/>').addClass("sem-backlinks-type bl-nofollow");
- td.append(div)
- }
- if (member.frame) {
- var div = $('<div/>').addClass("sem-backlinks-type bl-frame");
- td.append(div)
- }
- if (member.form) {
- var div = $('<div/>').addClass("sem-backlinks-type bl-form");
- td.append(div)
- }
- if (member.image) {
- var div = $('<div/>').addClass("sem-backlinks-type bl-image");
- td.append(div)
- }
- if (member.sitewide) {
- var div = $('<div/>').addClass("sem-backlinks-type bl-sitewide");
- td.append(div)
- }
- return '<td style="text-align:center;">' + td.html() + '</td>';
- },
- 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 '<a style="color:#009900" href="' + href + '"><span>' + this.roundNumRankNew(parsed) + '</span></a>'
- if (parsedMin == parsed)
- return '<a style="color:red" href="' + href + '"><span>' + this.roundNumRankNew(parsed) + '</span></a>'
- return '<a href="' + href + '">' + this.roundNumRankNew(parsed) + '</a>';
- },
- dispAdCopy: function(url, txt, desc, v_url, kw) {
- var td = $('<td>').attr('align', 'center').addClass('table-first-cell').addClass('ads-wr-open');
- var img_w = $('<div>').addClass('sem-widget-ad-icon');
- if (kw.length > 0) {
- txt = txt.replace(/<\/a>.+/i, "");
- desc = desc.replace(/<span[^>]*>(.+)?<\/span>/ig, "");
- desc = desc.replace(/<a[^>]*>(.+)?<\/a>/ig, "");
- if (desc.match(/<table[^>]*>/ig) && !desc.match(/<\/table>/ig))
- desc = '';
- desc = desc.replace(/<table[^>]*>(.+)?<\/table>/ig, "");
- desc = desc.replace(/ $/ig, "");
- desc = desc.replace(/<br>$/ig, "");
- img_w.addClass('sem-widget-ad-icon-active');
- var div = $('<div>').addClass('sem-widget-ad-view');
- var divStyle = $('<div>').addClass('sem-widget-ad-view-style');
- var divttl = $('<a>').addClass('ads-ln').attr({
- 'href': url,
- 'target': '_blank'
- }).html(txt);
- var divd = $('<div>').addClass('ads-d').html(desc);
- var cite = $('<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 align="center" style="text-align:center;" class="table-first-cell ads-wr-open">' + td.html() + '</td>';
- },
- dispAdCopy1: function(url, txt, desc, v_url, kw) {
- var td = $('<td>').attr('align', 'center').addClass('table-first-cell').addClass('ads-wr-open');
- var img_w = $('<div>').addClass('sem-widget-ad-icon');
- if (kw.length > 0) {
- txt = txt.replace(/<\/a>.+/i, "");
- desc = desc.replace(/<span[^>]*>(.+)?<\/span>/ig, "");
- desc = desc.replace(/<a[^>]*>(.+)?<\/a>/ig, "");
- if (desc.match(/<table[^>]*>/ig) && !desc.match(/<\/table>/ig))
- desc = '';
- desc = desc.replace(/<table[^>]*>(.+)?<\/table>/ig, "");
- desc = desc.replace(/ $/ig, "");
- desc = desc.replace(/<br>$/ig, "");
- img_w.addClass('sem-widget-ad-icon-active');
- var div = $('<div>').addClass('sem-widget-ad-view');
- var divStyle = $('<div>').addClass('sem-widget-ad-view-style');
- var divttl = $('<a>').addClass('ads-ln').attr({
- 'href': url,
- 'target': '_blank'
- }).html(txt);
- var span = $('<span>').addClass('sem-report-block-ad').html("Ad");
- var cite = $('<div>').addClass('sem-widget-type-ads-domain').append(span).append(v_url);
- var divd = $('<div>').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 align="center" style="text-align:center;" class="table-first-cell ads-wr-open">' + td.html() + '</td>';
- },
- 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 += '<nobr>';
- }
- if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
- ret += this.clipString4(domain, 25);
- } else {
- ret += domain;
- }
- if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
- ret += '</nobr>';
- }
- }
- return ret;
- },
- dispShoppingAd: function(url, title, price, shop_name, img, kw) {
- var td = $('<td>').attr('align', 'center').addClass('table-first-cell').addClass('ads-wr-open');
- var img_w = $('<div>').addClass('sem-widget-ad-icon');
- if (kw.length > 0) {
- title = title.replace(/<\/a>.+/i, "");
- img_w.addClass('sem-widget-ad-icon-active');
- var div = $('<div>').addClass('sem-widget-ad-view');
- div.append($('<div>').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 align="center" style="text-align:center;" class="table-first-cell ads-wr-open">' + td.html() + '</td>';
- },
- dispShoppingAdBody: function(url, title, price, shop_name, img) {
- price = price.replace(';"', '');
- var divStyle = $('<div>').addClass('sem-widget-ad-view-style')
- , divttl = $('<div>').addClass('sem-widget-ad-view-title').append($('<a>').addClass('product-title').attr({
- 'href': url,
- 'target': '_blank'
- }).html(title))
- , image = $('<div>').addClass('sem-widget-ad-view-img').append($('<a>').attr({
- 'href': url,
- 'target': '_blank'
- }).append($('<img alt="" />').attr('src', img).attr('onerror', this.imageError)))
- , cite = $('<div>').addClass('sem-widget-type-ads-shop').append(shop_name)
- , divd = $('<div>').addClass('ads-d').html(price);
- var divv = $('<div>').addClass('sem-widget-ad-view-txt').append(divttl).append(divd).append(cite);
- var block = $('<div>').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 = $('<div>').addClass('sem-widget-ad-view-style')
- , divttl = $('<div>').addClass('sem-widget-ad-view-title').append($('<p>').addClass('product-title').html(title))
- , image = $('<div>').addClass('sem-widget-ad-view-img').append($('<p>').append($('<img alt="" />').attr('src', img).attr('onerror', this.imageError)))
- , cite = $('<div>').addClass('sem-widget-type-ads-shop').append(shop_name)
- , divd = (price) ? $('<div>').addClass('ads-d').html(price) : '';
- var divv = $('<div>').addClass('sem-widget-ad-view-txt').append(divttl).append(divd).append(cite);
- var block = $('<div>').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 = '<a href="' + app.conf.DB_PREFIX + '/limit_results/"' + app.conf.ADD_REG_FORM + '>' + app.conf.R_UPLIM + '</a>';
- return ret;
- },
- displayAdsCell: function(member) {
- var td = $('<td>');
- if (member.Ph != undefined && member.Ph.length > 0) {
- td = $('<td>').css('vertical-align', 'top');
- if (member.Ds.match(/<table[^>]*>/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) + '<br />' + member.Vu.substring(35);
- }
- }
- member.Ds = member.Ds.replace(/<table[^>]*>(.+)?<\/table>/ig, "");
- member.Ds = member.Ds.replace(/<span[^>]*>(.+)?<\/span>/ig, "");
- member.Ds = member.Ds.replace(/<a[^>]*>(.+)?<\/a>/ig, "");
- member.Ds = member.Ds.replace(/ $/ig, "");
- member.Ds = member.Ds.replace(/<br>$/ig, "");
- member.Tt = member.Tt.replace(/<\/a>.+/i, "");
- td.html('<a href="' + member.Ur + '" target="_blank">' + member.Tt + '</a><div>' + member.Ds + '</div><div class="report_ads" title="' + member.Vu + '">' + member.Vu + '</span>');
- return '<td>' + td.html() + '</td>';
- } else {
- var td = $('<td>').attr({
- 'valign': 'middle',
- 'align': 'center',
- 'height': '72px'
- });
- td.html(this.displayLimits());
- return '<td style="text-align:center!important;height:72px;vertical-align:middle;">' + td.html() + '</td>';
- }
- },
- displayAdsBody: function(member) {
- if (member.Ph != undefined && member.Ph.length > 0) {
- if (member.Ds.match(/<table[^>]*>/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) + '<br />' + member.Vu.substring(35);
- }
- }
- member.Ds = member.Ds.replace(/<table[^>]*>(.+)?<\/table>/ig, "");
- member.Ds = member.Ds.replace(/<span[^>]*>(.+)?<\/span>/ig, "");
- member.Ds = member.Ds.replace(/<a[^>]*>(.+)?<\/a>/ig, "");
- member.Ds = member.Ds.replace(/ $/ig, "");
- member.Ds = member.Ds.replace(/<br>$/ig, "");
- member.Tt = member.Tt.replace(/<\/a>.+/i, "");
- var html = '<a href="' + member.Ur + '" target="_blank">' + member.Tt + '</a><div>' + member.Ds + '</div>';
- html += '<div class="report_ads" title="' + member.Vu + '">' + member.Vu + '</div>';
- return html;
- } else {
- return '<div style="text-align:center!important;height:72px;vertical-align:middle;">' + this.displayLimits() + '</div>';
- }
- },
- displayCategory: function(categories) {
- if (typeof categories == "undefined")
- return;
- var html = ""
- , catList = categories.split(', ');
- html += "<ul style='text-align: left'>";
- catList.forEach(function(item) {
- html += "<li>" + item + "</li>";
- });
- html += "</ul>";
- 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 = '<a title="' + title_text_ads + '" href="' + a_txt + '" >' + txt + '%</a>';
- }
- if (img) {
- a_img = '/info/' + link + '+(' + by_type + ')?adstype=media_ads';
- a_img = '<a title="' + title_media_ads + '" href="' + a_img + '" >' + img + '%</a>';
- }
- 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 ['<div style="position: relative; font-size: 11px; display: inline-block; width: ' + width + 'px; height: 18px; text-align: center;">', '<div style="position: absolute; width: ' + w50 + 'px; height: 18px; background-color: #CDE5FF; left: ' + left + 'px;"></div>', '<div style="position: absolute; width: ' + w48 + 'px; height: 16px; border: solid 1px #99CAFF;">' + text1 + '</div>', '<div style="position: absolute; width: ' + w49 + 'px; height: 16px; border: solid 1px #99CAFF; right: 0;">' + text2 + '</div>', '</div>'].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 = '<a title="' + title_text_ads + '" href="' + a_txt + '" >' + txt + '%</a>';
- }
- if (img) {
- a_img = '/analytics/da/cross/' + domain1 + '?advertiserDomain=' + domain1 + '&publisherDomain=' + domain2 + '&detailedName=mediaAds';
- a_img = '<a title="' + title_media_ads + '" href="' + a_img + '" >' + img + '%</a>';
- }
- var left = width * img / 200;
- return "<div class=\"sem-asns-text-media-container\">" + "<div class=\"sem-asns-text-media-fill\" style=\"left: " + left + "px;\"></div>" + "<div class=\"sem-asns-text-media-left\">" + a_txt + "</div>" + "<div class=\"sem-asns-text-media-right\">" + a_img + "</div>" + "<div class=\"sem-asns-text-media-separator\"></div>" + "</div>";
- 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 ['<div style="position: relative; font-size: 11px; display: inline-block; width: ' + width + 'px; height: 18px; text-align: center; top: -9px;">', '<div style="position: absolute; width: ' + w50 + 'px; height: 18px; background-color: #CDE5FF; left: ' + left + 'px; padding: 9px 0;"></div>', '<div style="position: absolute; width: ' + w48 + 'px; height: 16px;">' + text1 + '</div>', '<div style="position: absolute; width: ' + w49 + 'px; height: 16px; right: 0;">' + text2 + '</div>', '</div>'].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 "<span class=\"sem-widget-tracking-na\">" + i + "</span>";
- if (differenceFlag) {
- ret = (parseInt(i, 10) > 0) ? "-" + i : "+" + Math.abs(i);
- }
- if (i.length == 0) {
- return "<span class=\"sem-widget-empty-cell\">–</span>";
- } else if (parseInt(i, 10) == 0) {
- return "<span class=\"sem-widget-empty-cell\">0</span>";
- }
- if (differenceFlag) {
- if (parseInt(i, 10) > 0) {
- return "<span class=\"sem-widget-down-cell\">" + ret + "</span>";
- } else {
- return "<span class=\"sem-widget-up-cell\">" + ret + "</span>";
- }
- }
- return "<span class=\"sem-widget-po-value\">" + ret + "</span>";
- },
- 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 "<span class=\"sem-widget-tracking-na\">-</span>";
- if (parseFloat(i, 10) < 0) {
- return "<span class=\"sem-widget-down-cell\">" + ret + "</span>";
- } else if (parseFloat(i, 10) > 0) {
- return "<span class=\"sem-widget-up-cell\">" + ret + "</span>";
- } else {
- return "<span class=\"sem-widget-empty-cell\">0</span>";
- }
- },
- positionsDifference: function(i, diff) {
- var out = '';
- if (isNaN(parseInt(diff, 10)) || parseInt(diff, 10) == 0 || (i.length != 0 && isNaN(parseInt(i, 10)))) {
- out = "<span class=\"sem-widget-diff\"></span>";
- return out;
- }
- var ret = (parseInt(diff, 10) > 0) ? "-" + diff : "+" + Math.abs(diff);
- if (parseInt(diff, 10) > 0) {
- out = "<span class=\"sem-widget-diff sem-widget-diff-down\"><span>" + ret + "</span><i></i></span>";
- } else {
- out = "<span class=\"sem-widget-diff sem-widget-diff-up\"><span>" + ret + "</span><i></i></span>";
- }
- 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 = '<a href="' + url + '" target="_blank" class="sem-widget-tracking-source-link" title="' + app.Messages.serp_source + '"></a>';
- 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, """).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 '<div class="sem-report-header-td-diff ' + (show_tooltip ? 'sem-report-with-tooltip ' : '') + cssClass + '">' + sign + value_diff + '%' + (show_tooltip ? '<div class="sem-report-tooltip-down">' + this.displayDiffDivTooltip(value, value_prev, date, date_prev, postfix) + '</div>' : '') + '</div>'
- },
- displayDiffDivTooltip: function(value, prev_value, date, date_prev, postfix) {
- var tooltip = 'Current value: ' + value + postfix + ' (' + date + ')<br />' + '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 = '<span class="currency-sign">' + this.format.sign + '<div class="s-tooltip -topleft">' + this.format.code + '</div></span>';
- 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 = '<div class="bar-line">';
- html += '<div class="bar-line-inner" style="width: ' + value + '%;"></div>';
- html += '</div>';
- return html;
- },
- dispCheckFields: function(data, value) {
- if (_.indexOf(data, value) < 0) {
- return "";
- }
- return "<i class='s-icon -xs -check'></i>";
- },
- 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[^>]*>(.+)?<\/span>/ig, "");
- desc = desc.replace(/<a[^>]*>(.+)?<\/a>/ig, "");
- if (desc.match(/<table[^>]*>/ig) && !desc.match(/<\/table>/ig))
- desc = '';
- desc = desc.replace(/<table[^>]*>(.+)?<\/table>/ig, "");
- desc = desc.replace(/ $/ig, "");
- desc = desc.replace(/<br>$/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 = "<div class=\"js-currency-settings s-currency-settings\">\n\t<div class=\"js-drop-open\">\n\t\t<i class=\"s-icon -s -settings\"></i>\n\t</div>\n\t<div class=\"s-currency-selector__dropdown s-dropdown -dropdown-right\">\n\t\t<h3 class=\"s-dropdown__header -black\"><%= LOCALE.title %></h3>\n\t\t<div class=\"s-dropdown__body\">\n\t\t\t<select name=\"selector-currency\" class=\"sem-selector-currency\">\n\t\t\t\t<% _.forEach(data.models, function(item) { %>\n\t\t\t\t\t<option<% if(item.get('selected')) { %> selected=\"selected\"<% } %> value=\"<%= item.get('code') %>\">\n\t\t\t\t\t\t<%= item.get('code').toUpperCase() %>, <%= item.get('sign') %>\n\t\t\t\t\t</option>\n\t\t\t\t<% }); %>\n\t\t\t</select>\n\t\t</div>\n\t\t<div class=\"s-dropdown-btn\">\n\t\t\t<button class=\"s-btn -xs -hollow -default -btn-close js-btn-close\"><%= LOCALE.cancel %></button>\n\t\t\t<button class=\"s-btn -xs -success js-btn-apply\"><%= LOCALE.apply %></button>\n\t\t</div>\n\t</div>\n</div>"
- }
- , function(module, exports) {
- module.exports = "<div class=\"s-select -xs currency-switcher\">\n\t<div class=\"s-select__toogle\">\n\t\t<span class=\"s-btn__text s-link js-current-value\"><%= MIDDLE_WARE.db_currency %></span>\n\t\t<i class=\"s-icon -xxs -dropdown\"></i>\n\t</div>\n\t<div class=\"s-select__content\">\n\t\t<ul>\n\t\t\t<% _.forEach(data.models, function(item) { %>\n\t\t\t\t<li class=\"js-switch-currency s-select__item<% if(item.get('selected')) { %> -active<% } %>\" data-value=\"<%= item.get('code') %>\">\n\t\t\t\t\t<%= item.get('code') %>, <%= item.get('sign') %>\n\t\t\t\t</li>\n\t\t\t<% }); %>\n\t\t</ul>\n\t</div>\n</div>"
- }
- , , , , , , 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 += "<div class=\"sem-widget-header\">" + header + "</div>";
- }
- ret += "<div class=\"sem-widget-content\">";
- ret += "<div class=\"sem-widget-loader\"></div>";
- if (this.noResults) {
- ret += this.template("noResults");
- } else if (this.serverError) {
- ret += this.template("serverError");
- } else {
- ret += this.template("content");
- }
- ret += "</div>";
- if (footer) {
- ret += "<div class=\"sem-widget-footer clearfix\">" + this.template("footer") + "</div>";
- }
- 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 "<strong>" + this.point.series.name + "</strong><br />" + CONF.LOCALE.tooltip_x + ": " + app.helper.roundNumRankNew(this.point.x) + "<br />" + 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<h3 class=\"sem-widget-header-title\">\n\t\t<% if (typeof options.title_href != \"undefined\") { %><a href=\"<%= options.title_href %>\"><% } %><%= options.title %><% if (typeof options.title_href != \"undefined\") { %></a><% } %>\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<div class=\"sem-report-title-info sem-report-with-tooltip\">\n\t\t\t\t<div class=\"sem-report-title-info-description sem-report-tooltip-down<%= (typeof options.tooltip_position !== 'undefined') ? ' -right' : '' %>\">\n\t\t\t\t\t<%= options.tooltip %>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t<% } %>\n\t</h3>\n<% } else { %>\n<div> </div>\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 = "<p class=\"tooltip-title\"><%= title %></p>\n\n<% if (show_positions && _.first(data)) { %>\n\t<p><b><%= LOCALE.positions %>: <%= app.numberFormat((_.first(data)).total, 0, '.', ',') %></b></p>\n<% } %>\n\n<% if (data.length) { %>\n\t<table>\n\t\t<% _.each(data, function (item) { %>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<i class=\"tooltip-legend-icon\" style=\"background-color: <%= item.point.series.color %>\"></i>\n\t\t\t\t\t<%= item.point.series.name %>\n\t\t\t\t</td>\n\t\t\t\t<td><%= app.numberFormat(item.point.y, 0, \".\", \",\") %></td>\n\t\t\t</tr>\n\t\t<% }); %>\n\t</table>\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<div class=\"sem-widget-footer-lb sem-widget-search-form typeLine\">\n\t\t<% _.each (MIDDLE_WARE.typeLine, function(type) {\n\t\t\tvar isSelected = (type == selectedTypeLine) ? 'pressed' : ''; %>\n\n\t\t\t<a href=\"javascript:void(0);\" data-value=\"<%= type %>\" class=\"sem-widget-search-form-advanced <%= isSelected %>\">\n\t\t\t\t<%= LOCALE[type] %>\n\t\t\t</a>\n\t\t<% }); %>\n\t</div>\n\t<input type=\"hidden\" value=\"<%= selectedTypeLine %>\" 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<div class=\"sem-widget-footer-lb\" style=\"margin-top: 5px; margin-left: 10px; <%= showSelector ? '' : 'display: none;' %>\">\n\t\t<select id=\"typeLine\" name=\"typeLine\">\n\t\t\t<% _.each (MIDDLE_WARE.typeLine, function(type) { %>\n\t\t\t\t<option value=\"<%= type %>\" <%= (type == selectedTypeLine) ? 'selected=\"selected\"' : '' %>>\n\t\t\t\t\t<%= LOCALE[type] %>\n\t\t\t\t</option>\n\t\t\t<% }); %>\n\t\t</select>\n\t\t<% if (typeof selectedVsTypeLine != \"undefined\") { %>\n\t\t\tvs\n\t\t\t<select id=\"vsTypeLine\" name=\"vsTypeLine\">\n\t\t\t\t<% _.each (MIDDLE_WARE.typeLine, function(type) { %>\n\t\t\t\t\t<option value=\"<%= type %>\" <%= (type == selectedVsTypeLine) ? 'selected=\"selected\"' : '' %>>\n\t\t\t\t\t\t<%= LOCALE[type] %>\n\t\t\t\t\t</option>\n\t\t\t\t<% }); %>\n\t\t\t</select>\n\t\t<% } %>\n\t</div>\n<% } %>\n\n<% if (LOCALE.title) { %>\n\t<h3 class=\"sem-widget-header-title\"><%= LOCALE.title %></h3>\n<% } %>\n\n<div class=\"sem-widget-footer-rb sem-widget-search-form\" id=\"typeDate\">\n\t<% _.each (MIDDLE_WARE.typeDate, function(type) {\n\t\tvar isSelected = (type == selectedTypeDate) ? 'pressed' : ''; %>\n\n\t\t<a href=\"javascript:void(0);\" data-value=\"<%= type %>\" class=\"sem-widget-search-form-advanced <%= isSelected %>\">\n\t\t\t<%= LOCALE[type] %>\n\t\t</a>\n\t<% }); %>\n</div>"
- }
- , , , , , , , , , , , , , , , , , , , , , , 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<tr>\n\t<% } else { %>\n\t\t<tr title=\"<%= LOCALE.traffic %> <%= 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<td><%= helper.breakToThreeComa(item.get(\"Nq\")) %></td>\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</tr>\n<% } %>"
- }
- , function(module, exports) {
- module.exports = "<div class=\"sem-report-in-icon sem-report-in-icon-height\">\n\t<div class=\"sem-widget-col-titles\">\n\t\t<div class=\"sem-widget-title-text\">\n\t\t\t<%= helper.ucfirst(item.get(\"title\")) %>\n\t\t</div>\n\t</div>\n</div>"
- }
- , function(module, exports) {
- module.exports = "<% if (typeof options.fullReportLink !== \"undefined\") { %>\n<div class=\"sem-report-block-full-report\">\n\t<a href=\"<%= options.fullReportLink %>\"><%= LOCALE.full_report %></a>\n</div>\n<% } %>\n<% if (typeof options.exp !== \"undefined\") { %>\n<div class=\"sem-widget-footer-lb sem-widget-footer-export-links\"></div>\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<tr title=\"<%= LOCALE.competitor_relevance + ' ' + item.get('Cr') %>%\">\n\t<% } else { %>\n\t\t<tr title=\"<%= LOCALE.competitor_relevance + ' ' + Math.round(compRel[0]) %>%\">\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</tr>\n<% } %>\n"
- }
- , , , function(module, exports) {
- module.exports = "<div class=\"report-block-nothing-found\" style=\"display: block\">\n <h4><%= LOCALE.nothing_found %></h4>\n</div>"
- }
- , , 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 = "<tr>\n <td data-test-domain-overview-top-anchors-item-anchor><%= helper.displayFormattedAnchor(helper.clipString4(item.attributes.anchor, 80), LOCALE.empty_anchor)%></td>\n\t<td data-test-domain-overview-top-anchors-item-domains-count><%= helper.breakToThreeComa(item.attributes.domains_num) %></td>\n\t<td data-test-domain-overview-top-anchors-item-backlinks-count><%= helper.breakToThreeComa(item.attributes.backlinks_num) %></td>\n</tr>\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 += "<div class=\"sem-widget-content\">";
- ret += "<div class=\"sem-widget-loader\"></div>";
- ret += "</div>";
- 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('<div class="sem-widget-content"><div class="sem-widget-loader" style="width: 100%; height: 150px;display: block;padding: 30px;margin-left: -30px;"></div></div>');
- 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<h4 class=\"sem-report-with-tooltip sem-report-block-title-td\" data-id=\"asns\">\n\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-3\"></span>\n\t<%= LOCALE.summary_title %>\n\t<div class=\"sem-report-tooltip-left\"><%= LOCALE.adsense_tooltip %></div>\n</h4>\n<div class=\"sem-report-block-row\">\n\t<div class=\"sem-report-block-row-td minimized\">\n\t\t<a class=\"cl-metric-ads s-report__counter\" href=\"/analytics/da/overview/<%= encodeURIComponent(MIDDLE_WARE.domain_id) %>\">\n\t\t\t<%= helper.roundNumRank(model.get(\"adsCount\")) %>\n\t\t</a>\n\t</div>\n\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.ads_total_num_of_ads %></div>\n</div>\n\n<table class=\"sem-report-block-summary-table\">\n\t<tr>\n\t\t<td><%= LOCALE.ads_publishers_count_title %></td>\n\t\t<td class=\"right\">\n\t\t\t<% if (model.get(\"publishersCount\") > 0) { %>\n\t\t\t<a class=\"cl-metric-publishers\" href=\"/analytics/da/publishers/<%= encodeURIComponent(MIDDLE_WARE.domain_id) %>\">\n\t\t\t\t<%= helper.roundNumRank(model.get(\"publishersCount\")) %>\n\t\t\t</a>\n\t\t\t<% } else { %>\n\t\t\t<span class=\"zero\">0</span>\n\t\t\t<% } %>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td><%= LOCALE.ads_advertisers_count_title %></td>\n\t\t<td class=\"right\">\n\t\t\t<% if (model.get(\"advertisersCount\") > 0) { %>\n\t\t\t<a class=\"cl-metric-advert\" href=\"/analytics/da/advertisers/<%= encodeURIComponent(MIDDLE_WARE.domain_id) %>\">\n\t\t\t\t<%= helper.roundNumRank(model.get(\"advertisersCount\")) %>\n\t\t\t</a>\n\t\t\t<% } else { %>\n\t\t\t<span class=\"zero\">0</span>\n\t\t\t<% } %>\n\t\t</td>\n\t</tr>\n</table>\n<% } %>\n"
- }
- , function(module, exports) {
- module.exports = "<% if (typeof data !== \"undefined\" && data.length) {\nvar model = data.first();\n%>\n<div class=\"sem-report-with-tooltip\">\n\t<div class=\"sem-report-header-table\">\n\t\t<div class=\"sem-report-header-td-title\">\n\t\t\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-3\"></span>\n\t\t\t<%= LOCALE.adsense_title %>\n\t\t</div>\n\t\t<div class=\"sem-report-block-row\">\n\t\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t\t<%= helper.roundNumRankFormatted(model.get(\"adsCount\")) %>\n\t\t\t</div>\n\t\t\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.ads_total_num_of_ads %></div>\n\t\t</div>\n\t</div>\n\t<div class=\"sem-report-tooltip-down\"><%= LOCALE.adsense_tooltip %></div>\n</div>\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 += "<div class=\"sem-widget-content\">";
- ret += "<div class=\"sem-widget-loader\"></div>";
- ret += "</div>";
- 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('<div class="sem-widget-content"><div class="sem-widget-loader" style="width: 100%; height: 300px;display: block;padding: 30px;margin-left: -30px;"></div></div>');
- 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<h4 class=\"sem-report-with-tooltip sem-report-block-title-td\" data-id=\"<%= MIDDLE_WARE.type %>\">\n\t\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-<%= MIDDLE_WARE.type === 'organic' ? '0' : '1' %>\"></span>\n\t\t<%= LOCALE.summary_title %>\n\t\t<div class=\"sem-report-tooltip-left\"><%= LOCALE.tooltip %></div>\n\t</h4>\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<div class=\"sem-report-block-row\">\n\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t<a class=\"s-report__counter cl-metric-traffic\" href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + MIDDLE_WARE.domain_id + '+(by+' + MIDDLE_WARE.type + ')' %>\">\n\t\t\t\t<%= helper.roundNumRank(model.get(\"traffic\")) %>\n\t\t\t</a>\n\t\t</div>\n\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t<div class=\"sem-report-header-td-diff <%= cssClass %>\"><%= sign + model.get(\"traffic_diff\") %>%</div>\n\t\t</div>\n\t\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.traffic %></div>\n\t</div>\n\n\t<table class=\"sem-report-block-summary-table\">\n\t\t<% if (MIDDLE_WARE.type == 'organic') { %>\n\t\t<tr>\n\t\t\t<td><%= LOCALE.rank %></td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<a class=\"cl-metric-rank\" href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + MIDDLE_WARE.domain_id + '+(by+' + MIDDLE_WARE.type + ')' %>\">\n\t\t\t\t\t<%= helper.roundNumRank(model.get(\"rank\")) %>\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t\t<td class=\"right\"></td>\n\t\t</tr>\n\t\t<% } %>\n\t\t<tr>\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<td><%= LOCALE.keywords %></td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<a class=\"cl-metric-keywords\" href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + MIDDLE_WARE.domain_id + '+(by+' + MIDDLE_WARE.type + ')' %>\">\n\t\t\t\t\t<%= helper.roundNumRank(model.get(\"keywords\")) %>\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<div class=\"sem-report-header-td-diff <%= cssClass %>\"><%= sign + model.get(\"keywords_diff\") %>%</div>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\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<td><%= LOCALE.traffic_cost %></td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<a class=\"cl-metric-cost\" href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + MIDDLE_WARE.domain_id + '+(by+' + MIDDLE_WARE.type + ')' %>\">\n\t\t\t\t\t<%= helper.formatPriceRoundNum(model.get(\"traffic_price\"), MIDDLE_WARE.db_currency) %>\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<div class=\"sem-report-header-td-diff <%= cssClass %>\"><%= sign + model.get(\"traffic_price_diff\") %>%</div>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\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<div class=\"sem-report-with-tooltip\">\n\t\t\t<div class=\"sem-report-header-table\">\n\t\t\t\t<div class=\"sem-report-header-td-title\">\n\t\t\t\t\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-<%= MIDDLE_WARE.type === 'organic' ? '0' : '1' %>\"></span>\n\t\t\t\t\t<%= LOCALE.title %>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"sem-report-block-row\">\n\t\t\t\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t\t\t\t<%= helper.roundNumRankFormatted(model.get(\"traffic\")) %>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t\t\t\t<div class=\"sem-report-header-td-diff <%= cssClass %>\"><%= sign + model.get(\"traffic_diff\") %>%</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.traffic %></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class=\"sem-report-tooltip-down\"><%= LOCALE.tooltip %></div>\n\t\t</div>\n\t\t\n<%\t} %>"
- }
- , function(module, exports) {
- module.exports = "<h4 class=\"sem-report-with-tooltip sem-report-block-title-td\" data-id=\"<%= MIDDLE_WARE.type %>\">\n\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-<%= MIDDLE_WARE.type === 'organic' ? '0' : '1' %>\"></span>\n\t<%= LOCALE.summary_title %>\n\t<div class=\"sem-report-tooltip-left\"><%= LOCALE.tooltip %></div>\n</h4>\n<div class=\"sem-report-nothing-found\">\n\t<p><%= LOCALE.nothing_found_title %></p>\n\t<a href=\"javascript: void(0)\" class=\"show-data-link\"><%= LOCALE.nothing_found_text %><i></i></a>\n\n\t<div class=\"suggestion-box\" style=\"display: none\">\n\t\t<p><%= LOCALE.nothing_found_tracking_text %></p>\n\t\t<a href=\"/projects\" class=\"s-btn -xs -success\">\n\t\t\t<span class=\"s-btn__text\">Go to Position Tracking</span>\n\t\t</a>\n\t\t<div class=\"sem-report-title-info sem-report-with-tooltip\">\n\t\t\t<div class=\"sem-report-title-info-description sem-report-tooltip-down\"><%= LOCALE.go_to_tracking_tooltip %></div>\n\t\t</div>\n\t</div>\n</div>\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 += "<div class=\"sem-widget-content\">";
- ret += "<div class=\"sem-widget-loader\"></div>";
- ret += "</div>";
- 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('<div class="sem-widget-content"><div class="sem-widget-loader" style="width: 100%; height: 50px;display: block;padding: 30px;margin-left: -30px;"></div></div>');
- 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<h4 class=\"sem-report-with-tooltip sem-report-block-title-td\" data-id=\"backlinks\" data-test-domain-overview-widget-title>\n\t\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-2\"></span>\n\t\t<%= LOCALE.summary_title %>\n\t\t<div class=\"sem-report-tooltip-left\"><%= LOCALE.backlinks_tooltip %></div>\n\t</h4>\n\t<div class=\"sem-report-block-row\">\n\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t<a class=\"s-report__counter cl-metric-backlinks\" href=\"/analytics/backlinks/backlinks/<%= encodeURIComponent(MIDDLE_WARE.link) %>:<%= MIDDLE_WARE.target_type %>\" data-test-domain-overview-total-backlinks-count>\n\t\t\t\t<%= helper.roundNumRank(model.get(\"backlinks\")) %>\n\t\t\t</a>\n\t\t</div>\n\t\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.total %></div>\n\t</div>\n\n\t<table class=\"sem-report-block-summary-table\">\n\t\t<tr>\n\t\t\t<td><%= LOCALE.ref_domains %></td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<a class=\"cl-metric-domains\" href=\"/analytics/backlinks/refdomains/<%= encodeURIComponent(MIDDLE_WARE.link) %>:<%= 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</a>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td><%= LOCALE.ref_ips %></td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<a class=\"cl-metric-ip\" href=\"/analytics/backlinks/refips/<%= encodeURIComponent(MIDDLE_WARE.link) %>:<%= 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</a>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n<%\t} %>\n"
- }
- , function(module, exports) {
- module.exports = "<%\tif (typeof data !== \"undefined\" && data.length) {\n\t\tvar model = data.first();\n%>\n\t<div class=\"sem-report-with-tooltip\">\n\t\t<div class=\"sem-report-header-table\">\n\t\t\t<div class=\"sem-report-header-td-title\">\n\t\t\t\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-2\"></span>\n\t\t\t\t<%= LOCALE.backlinks_title %>\n\t\t\t</div>\n\t\t\t<div class=\"sem-report-block-row\">\n\t\t\t\t<div class=\"sem-report-block-row-td minimized\" data-test-domain-overview-ribbon-total-backlinks-count>\n\t\t\t\t\t<%= helper.roundNumRankFormatted(model.get(\"backlinks\")) %>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.total %></div>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class=\"sem-report-tooltip-down\"><%= LOCALE.backlinks_tooltip %></div>\n\t</div>\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 = "<style>\n\t#ta-engagement-metrics {\n\t\tmin-height: 0;\n\t\tmargin: 8px -30px 0;\n\t\tbackground: #f5f5f5;\n\t\tborder-bottom: 1px solid #dae4e7;\n\t\tborder-top: 1px solid #dae4e7;\n\t}\n\n\t#ta-engagement-metrics .widget {\n\t\tpadding: 4px 0 24px;\n\t\tbox-sizing: border-box;\n\t\twidth: calc(100% - 30px);\n\t}\n\n\t#ta-engagement-metrics .widget-header {\n\t\tborder-bottom: 1px solid #b4b4b4;\n width: calc(75% - 28px);\n\t\tmargin-left: 28px;\n\t\tpadding-bottom: 5px;\n\t\tbox-sizing: border-box;\n\t}\n\n\t#ta-engagement-metrics .widget-table {\n\t\twidth: 100%;\n\t}\n\n\t#ta-engagement-metrics .widget-table td {\n\t\tvertical-align: top;\n\t\twidth: 25%;\n\t\tpadding: 8px 0px 8px 27px;\n\t\ttext-align: left;\n\t}\n\n\t#ta-engagement-metrics .widget-table td:last-child {\n\t\tpadding-top: 0;\n\t\tpadding-bottom: 0;\n\t}\n\n\t#ta-engagement-metrics .widget-table td,\n\t#ta-engagement-metrics .widget-table td:hover {\n\t\tbox-shadow: none;\n\t\tborder-left: none;\n\t\tbackground: none;\n\t}\n\n\t#ta-engagement-metrics .widget-title {\n\t\tpadding-top: 12px;\n\t\tcursor: pointer;\n\t\tdisplay: inline-block;\n\t\tfont-size: 16px;\n\t\tfont-weight: 500;\n\t\tfont-family: Ubuntu, sans-serif;\n\t\ttext-transform: uppercase;\n\t\ttext-align: left;\n\t\tcolor: #333;\n\t}\n\n\t#ta-engagement-metrics .widget-title a {\n\t\ttext-decoration: none;\n\t\tcolor: #333;\n\t}\n\n\t#ta-engagement-metrics .widget-info {\n\t\tdisplay: inline-block;\n\t\tmargin-left: 20px;\n\t\tpadding-top: 12px;\n\t\tcursor: default;\n\t}\n\n\t#ta-engagement-metrics .widget-info-db {\n\t\tposition: relative;\n\t\tcolor: #757575;\n\t\tpadding-right: 13px;\n\t\tfont-size: 12px;\n\t\tdisplay: inline-block;\n\t}\n\n\t#ta-engagement-metrics .widget-info-db span {\n\t\tmargin-left: 4px;\n\t}\n\n\t#ta-engagement-metrics .widget-info-db svg {\n\t\tdisplay: inline-block;\n\t\tvertical-align: -2px;\n\t\tcolor: #a6b0b3;\n\t}\n\n\t#ta-engagement-metrics .widget-info-db:after {\n\t\tposition: absolute;\n\t\tcontent: \"\";\n\t\tdisplay: block;\n\t\twidth: 1px;\n\t\theight: 16px;\n\t\tbackground-color: #cccccc;\n\t\ttop: -1px;\n\t\tright: 0;\n\t}\n\n\t#ta-engagement-metrics .widget-info-date {\n\t\tmargin-left: 12px;\n\t\tcolor: #757575;\n\t\tfont-size: 12px;\n\t}\n\n\t#ta-engagement-metrics .button {\n\t\tdisplay: inline-block;\n\t\tmargin: 0 auto;\n\t\tpadding: 5px 8px;\n\n\t\tborder-radius: 3px;\n\t\tborder: solid 1px #a6b0b3;\n\t\tcolor: #666;\n\t\tbackground-color: rgba(166, 176, 179, 0.1);\n\t\ttext-decoration: none;\n\t}\n\n\t#ta-engagement-metrics .button:hover {\n\t\tbackground-color: hsla(194, 8%, 68%, .2);\n\t}\n\n\t#ta-engagement-metrics .button-container {\n\t\ttext-align: center;\n\t}\n\n\t#ta-engagement-metrics .cell-metric {\n\t\tdisplay: flex;\n\t\tline-height: 1.3;\n\t}\n\n\t#ta-engagement-metrics .cell-metric-title {\n\t\tmargin-right: auto;\n\t\tpadding-right: 1em;\n\t}\n\n\t#ta-engagement-metrics .cell-metric-value {\n\t\tmargin-right: 16px;\n\t\tcolor: #333;\n\t\ttext-decoration: none;\n\t}\n\n\t#ta-engagement-metrics .cell-metric-diff {\n\t\tcolor: #ccc;\n\t}\n\n\t#ta-engagement-metrics .cell-metric-diff.positive {\n\t\tcolor: #20aa00;\n\t}\n\n\t#ta-engagement-metrics .cell-metric-diff.negative {\n\t\tcolor: #dd0500;\n\t}\n</style>\n\n<div class=\"widget\" id=\"ta-engagement-metrics-content\">\n\t<div class=\"widget-header\">\n\t\t<h4 class=\"widget-title sem-report-with-tooltip\">\n\t\t\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-7\"></span>\n\t\t\t<a href=\"<%= '/analytics/traffic/overview/' + data.domain %>\" onclick=\"<%= helper.getGAEventDispatcher('Click widget title')%>\">\n\t\t\t\t<%= LOCALE.ta_engagement_title %>\n\t\t\t</a>\n\n\t\t\t<div class=\"sem-report-tooltip-left\">\n\t\t\t\t<%= LOCALE.ta_engagement_tooltip %>\n\t\t\t</div>\n\t\t</h4>\n\n\t\t<span class=\"widget-info sem-report-with-tooltip\">\n\t\t\t<span class=\"widget-info-db\">\n\t\t\t\t<svg fill=\"currentColor\" preserveAspectRatio=\"xMidYMid meet\" viewBox=\"0 0 12 12\" width=\"12\"\n\t\t\t\t\theight=\"12\" data-name=\"Globe\" data-group=\"xs\">\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M6 0c3.313 0 6 2.687 6 6 0 3.314-2.687 6-6 6-3.314 0-6-2.686-6-6 0-3.313 2.686-6 6-6zm1.86 10.633c1.837-.741 3.14-2.534 3.14-4.633 0-1.981-1.167-3.681-2.842-4.49-.59.204-.762 1.06-1.096 1.394-.254.254-.466.21-.778.21s-.751.067-.976.147c-.224.081-.408.402-.408.713 0 .311.097.663.215.781.117.117.215.368.215.556 0 .188-.131.343-.291.343-.16 0-.618-.249-1.02-.552-.401-.303-.815-.447-1.062-.552-.247-.104-.334-.277-.334-.618 0-.332-.283-.934-.471-1.086-.709.863-1.152 1.953-1.152 3.154 0 2.757 2.243 5 5 5 .273 0 .535-.038.797-.08.314-.87.955-2.84.396-3.044-.717-.262-.97-1.072-.957-1.77.014-.699.904-.754 1.084-.617.18.138.641.363 1.754.675 1.111.312.523 2.231-.324 2.866-.569.426-.799 1.161-.89 1.603z\"\n\t\t\t\t\t\tshape-rendering=\"geometricPresision\"></path>\n\t\t\t\t</svg>\n\t\t\t\t<span><%= LOCALE.ta_engagement_db_global %></span>\n\t\t\t</span><span class=\"widget-info-date\"><%= helper.formatDate(data.displayDate, 'MMM YYYY') %></span>\n\n\t\t\t<div class=\"sem-report-tooltip-left\">\n\t\t\t\t<%= LOCALE.ta_engagement_db_global_tooltip %>\n\t\t\t</div>\n\t\t</span>\n\t</div>\n\n\t<div class=\"widget-body\">\n\t\t<table class=\"widget-table\">\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<span class=\"cell-metric\">\n\t\t\t\t\t\t<span class=\"cell-metric-title\">\n\t\t\t\t\t\t\t<%= LOCALE.ta_engagement_metric_ppv %>\n\t\t\t\t\t\t</span>\n\n\t\t\t\t\t\t<a href=\"<%= '/analytics/traffic/overview/' + data.domain %>\" 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</a>\n\n\t\t\t\t\t\t<span class=\"<%= 'cell-metric-diff ' + helper.getDiffCssClass(data.totalPagesPerVisitDiff) %>\">\n\t\t\t\t\t\t\t<%= helper.getSign(data.totalPagesPerVisitDiff) + helper.convertToPercent(data.totalPagesPerVisitDiff) %>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</span>\n\t\t\t\t</td>\n\n\n\t\t\t\t<td>\n\t\t\t\t\t<span class=\"cell-metric\">\n\t\t\t\t\t\t<span class=\"cell-metric-title\">\n\t\t\t\t\t\t\t<%= LOCALE.ta_engagement_metric_avd %>\n\t\t\t\t\t\t</span>\n\n\t\t\t\t\t\t<a href=\"<%= '/analytics/traffic/overview/' + data.domain %>\" 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</a>\n\n\t\t\t\t\t\t<span class=\"<%= 'cell-metric-diff ' + helper.getDiffCssClass(data.totalAvgVisitDurationDiff) %>\">\n\t\t\t\t\t\t\t<%= helper.getSign(data.totalAvgVisitDurationDiff) + helper.convertToPercent(data.totalAvgVisitDurationDiff) %>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</span>\n\t\t\t\t</td>\n\n\n\t\t\t\t<td>\n\t\t\t\t\t<span class=\"cell-metric\">\n\t\t\t\t\t\t<span class=\"cell-metric-title\">\n\t\t\t\t\t\t\t<%= LOCALE.ta_engagement_metric_br %>\n\t\t\t\t\t\t</span>\n\n\t\t\t\t\t\t<a href=\"<%= '/analytics/traffic/overview/' + data.domain %>\" 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</a>\n\n\t\t\t\t\t\t<span class=\"<%= 'cell-metric-diff ' + helper.getDiffCssClass(data.totalBounceRateDiff, true) %>\">\n\t\t\t\t\t\t\t<%= helper.getSign(data.totalBounceRateDiff) + helper.convertToPercent(data.totalBounceRateDiff) %>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</span>\n\t\t\t\t</td>\n\n\t\t\t\t<td>\n\t\t\t\t\t<div class=\"button-container\">\n\t\t\t\t\t\t<a href=\"<%= '/analytics/traffic/overview/' + data.domain %>\" class=\"button\" onclick=\"<%= helper.getGAEventDispatcher('Click Show all metrics')%>\">\n\t\t\t\t\t\t\t<%= LOCALE.ta_engagement_cta %>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>\n</div>\n\n<script>\n\tvar widget = document.getElementById('ta-engagement-metrics-content');\n\tvar callback = _.debounce(function() {\n\t\tga('send', {\n\t\t\thitType: 'event',\n\t\t\teventCategory: 'Traffic Analytics',\n\t\t\teventAction: 'Engagement metrics widget',\n\t\t\teventLabel: 'Mouse over widget'\n\t\t});\n\t}, 1000);\n\n\twidget.addEventListener('mouseenter', callback);\n\twidget.addEventListener('mouseleave', function() {\n\t\tcallback.cancel();\n\t});\n</script>\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<div style=\"display: inline-block;\">\n\t\t<%= LOCALE.category %>:\n\t\t<% _.each(_.take(data.categories, 3), function(category) { %>\n\t\t\t<<%= (MIDDLE_WARE.type == \"domain_rank\") ? \"a\" : \"span\" %><%= (positionsHref) ? \" href=\\\"\" + positionsHref + category.id + \"\\\"\" : \"\" %> class=\"s-link report-title-categories-el\">\n\t\t\t\t<%= LOCALE[\"domain_Ca_\" + category.id] %></<%= (MIDDLE_WARE.type == \"domain_rank\") ? \"a\" : \"span\" %>>\n\t\t<% }); %>\n\n\t\t<% if (MIDDLE_WARE.type == \"domain_rank\") { %>\n\t\t\t<div class=\"s-dropdown-white\">\n\t\t\t\t<span class=\"s-dropdown-btn\">\n\t\t\t\t\t<%= LOCALE.show_ratio %>\n\t\t\t\t\t<span class=\"caret\"></span>\n\t\t\t\t</span>\n\t\t\t\t<ul class=\"s-dropdown-menu\">\n\t\t\t\t\t<% _.each(data.categories, function(category) { %>\n\t\t\t\t\t\t<li class=\"clearfix\">\n\t\t\t\t\t\t\t<span class=\"s-float -right\"><%= category.ratio %>%</span>\n\t\t\t\t\t\t\t<a class=\"js-drop-category s-link\" href=\"<%= positionsHref + category.id %>\"><%= LOCALE[\"domain_Ca_\" + category.id] %></a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t<% }) %>\n\t\t\t\t\t<% if (data.other) { %>\n\t\t\t\t\t<li class=\"clearfix\">\n\t\t\t\t\t\t<span class=\"s-float -right\"><%= data.other.ratio %>%</span>\n\t\t\t\t\t\t<%= LOCALE.other %>\n\t\t\t\t\t</li>\n\t\t\t\t\t<% } %>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t<% } %>\n\t</div>\n<% } %>\n"
- }
- , function(module, exports) {
- module.exports = "<div class=\"sem-report-database-suggestions\">\n\t<% if (databases[0]) { %>\n\t<%= CONF.LOCALE.other_databases %> <a href=\"<%= (databases[0] === 'us') ? '' : '/' + databases[0] %><%= CONF.MIDDLE_WARE.date_prefix %>/info/<%= CONF.MIDDLE_WARE.domain_id %>\"><span><%= databases[0] %></span> <%= CONF.MIDDLE_WARE['database_list'][databases[0]]['sel'] %></a>\n\t<% } %>\n\t<% if (databases.length > 1) { %>\n\t\tand\n\t\t<% if (databases.length > 2) { %>\n\n\t\t\t<div class=\"database-select\">\n\t\t\t\t<div class=\"database-select-text\"><span><%= databases.length - 1 %> more</span><i></i></div>\n\t\t\t\t<ul class=\"database-dropdown\">\n\t\t\t\t\t<% for (var i = 1, length = databases.length; i < length; i++) { %>\n\t\t\t\t\t\t<li class=\"database-dropdown-item\">\n\t\t\t\t\t\t\t<a class=\"sa-tool-settings-dropdown-link\" href=\"<%= (databases[i] === 'us') ? '' : '/' + databases[i] %><%= CONF.MIDDLE_WARE.date_prefix %>/info/<%= CONF.MIDDLE_WARE.domain_id %>\"><span><%= databases[i] %></span> <%= CONF.MIDDLE_WARE['database_list'][databases[i]]['sel'] %></a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t<% } %>\n\t\t\t\t</ul>\n\t\t\t</div>\n\n\t\t<% } else { %>\n\t\t\t<a href=\"<%= (databases[1] === 'us') ? '' : '/' + databases[1] %><%= CONF.MIDDLE_WARE.date_prefix %>/info/<%= CONF.MIDDLE_WARE.domain_id %>\"><span><%= databases[1] %></span> <%= CONF.MIDDLE_WARE['database_list'][databases[1]]['sel'] %></a>\n\t\t<% } %>\n\t<% } %>\n\t<span class=\"close-notification\"></span>\n</div>"
- }
- , 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 + ": " + "<a href='" + getLink(this.point.x) + "'>" + app.numberFormat(this.y, 0, ".", ",") + "</a>";
- }
- },
- 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) { %>" + "<tr class=\"sem-widget-overview-info\">" + "<% data.each(function(item, countTr) { %>" + "<% if (countTr < 4) { %>" + this.template("tr") + "<% } %>" + "<% if (countTr < 3) { %>" + "<td><div style=\"width: 27px; display: block;\"></div></td>" + "<% } %>" + "<% }); %>" + "</tr>" + "<% } else { %>" + "<td<% if (typeof header !== \"undefined\" && header.length) { %>" + "colspan=\"<%= header.length %>\"<% } %> class=\"sem-widgets-no-results\"" + ">" + this.template("nothingFound") + "</td>" + "<% } %>";
- },
- 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 = "<td style=\"width: 25%;\">\n\t<a href=\"<%= decodeURIComponent(item.get(\"Ur\")) %>\" target=\"_blank\"><%= item.get(\"Tt\").replace(/<\\/a>.+/i, \"\") %></a>\n\t<% if (item.get(\"Vu\")) { %>\n\t<div class=\"sem-widget-type-ads-domain\" title=\"<%= item.get(\"Vu\") %>\"><span class=\"sem-report-block-ad\">Ad</span><%= item.get(\"Vu\") %></div>\n\t<% } %>\n\t<div><%= helper.replaceAdvDescription(item.get(\"Ds\")) %></div>\n</td>\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 += "<div class=\"sem-widget-header\">" + header + "</div>";
- }
- ret += "<div class=\"sem-widget-content\">";
- ret += "<div class=\"sem-widget-loader\"></div>";
- ret += "</div>";
- if (this.noResults) {
- ret += this.template("noResults");
- } else if (this.serverError) {
- ret += this.template("serverError");
- } else {
- ret += this.template("content");
- }
- if (footer) {
- ret += "<div class=\"sem-widget-footer clearfix\">" + this.template("footer") + "</div>";
- }
- 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<div class=\"sem-report-block-flag-counter sem-report-with-tooltip\">\n\t\t<a href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX %>/info/<%= MIDDLE_WARE.link %>+(backlinks)?target_type=<%= MIDDLE_WARE.target_type %>\"><%= helper.roundNumRankFormatted(data.attributes.total) %></a>\n\t\t<div class=\"sem-report-tooltip-right\"><%= LOCALE.total_tooltip %></div>\n\t</div>\n\t<%= LOCALE.total %>\n\t<div class=\"sem-report-block-flag-counter-delimiter\"></div>\n\t<div class=\"sem-report-block-flag-counter sem-report-with-tooltip\">\n <a href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX %>/info/<%= MIDDLE_WARE.link %>+(backlinks_refdomains)?target_type=<%= MIDDLE_WARE.target_type %>\"><%= helper.roundNumRankFormatted(data.attributes.domains) %></a>\n\t\t<div class=\"sem-report-tooltip-right\"><%= LOCALE.referring_domains_tooltip %></div>\n\t</div>\n\t<%= LOCALE.referring_domains %>\n\t<div class=\"sem-report-block-flag-counter-delimiter\"></div>\n\t<div class=\"sem-report-block-flag-counter sem-report-with-tooltip\">\n <a href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX %>/info/<%= MIDDLE_WARE.link %>+(backlinks_refips)?target_type=<%= MIDDLE_WARE.target_type %>\"><%= helper.roundNumRankFormatted(data.attributes.ip) %></a>\n\t\t<div class=\"sem-report-tooltip-right\"><%= LOCALE.referring_ips_tooltip %></div>\n\t</div>\n\t<%= LOCALE.referring_ips %>\n\t<div><i class=\"sem-arrow-down\"></i></div>\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 ? '<b>' + this.point.name + ':</b> ' + app.numberFormat(this.y, 2, ".", ",") + '%' : null;
- }
- }
- },
- templates: {
- nothingFound: function() {
- return "<div class=\"sem-widget-nothing-found-style\">" + CONF.LOCALE.no_trend_data + "</div>";
- },
- 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<div class=\"sem-report-block-legend-new\">\n\t<a class=\"backlinks-follow\" href=\"<%= data.followLink %>\"><div class=\"sem-report-block-counter-new\" data-test-domain-overview-follow-widget-follow-links-count><%= helper.roundNumRankFormatted(data.follow) %></div>\n\t\t<div class=\"sem-report-counter-legend-new\"><%= LOCALE.dofollow %></div></a>\n\t<a class=\"backlinks-nofollow\" href=\"<%= data.nofollowLink %>\"><div class=\"sem-report-block-counter-new\" data-test-domain-overview-follow-widget-nofollow-links-count><%= helper.roundNumRankFormatted(data.nofollow) %></div>\n\t\t<div class=\"sem-report-counter-legend-new sem-report-counter-legend-new-1\"><%= LOCALE.nofollow %></div></a>\n</div>\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 '<b>' + this.point.name + ':</b> ' + app.numberFormat(this.point.yReal, 2, ".", ",") + '%';
- }
- }
- },
- templates: {
- nothingFound: function() {
- return '<div class="sem-widget-nothing-found-style">' + CONF.LOCALE.no_trend_data + '</div>';
- },
- 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<div class=\"sem-report-block-legend-new\">\n\n <a class=\"legend-text\" href=\"<%= data.textLink %>\"><div class=\"sem-report-block-counter-new\" data-test-domain-overview-backlinks-widget-text-links-count><%= helper.roundNumRankFormatted(data.text) %></div>\n\t\t<div class=\"sem-report-counter-legend-new\"><%= LOCALE.text %></div></a>\n\n <a class=\"legend-frame\" href=\"<%= data.frameLink %>\"><div class=\"sem-report-block-counter-new\" data-test-domain-overview-backlinks-widget-frame-links-count><%= helper.roundNumRankFormatted(data.frame) %></div>\n <div class=\"sem-report-counter-legend-new sem-report-counter-legend-new-1\"><%= LOCALE.frame %></div></a>\n\n <a class=\"legend-form\" href=\"<%= data.formLink %>\"><div class=\"sem-report-block-counter-new\" data-test-domain-overview-backlinks-widget-form-links-count><%= helper.roundNumRankFormatted(data.form) %></div>\n <div class=\"sem-report-counter-legend-new sem-report-counter-legend-new-2\"><%= LOCALE.form %></div></a>\n\n <a class=\"legend-image\" href=\"<%= data.imageLink %>\"><div class=\"sem-report-block-counter-new\" data-test-domain-overview-backlinks-widget-image-links-count><%= helper.roundNumRankFormatted(data.image) %></div>\n <div class=\"sem-report-counter-legend-new sem-report-counter-legend-new-3\"><%= LOCALE.image %></div></a>\n</div>\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 = "<tr>\n\t<%= helper.displayBacklinkLinkSource(item.attributes) %>\n\t<%= helper.displayBacklinkAnchorTarget(item.attributes) %>\n\t<%= helper.displayBacklinkType(item.attributes) %>\n</tr>\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 = "<tr>\n\t<td data-test-domain-overview-refdomains-item-root-domain><%= helper.displayRefDomainLink(item.get(\"domain\")) %></td>\n\t<td data-test-domain-overview-refdomains-item-backlinks-count><%= helper.breakToThreeComa(item.attributes.backlinks_num) %></td>\n\t<td><span data-test-domain-overview-refdomains-item-country><%= helper.displayCountryFlag(item.attributes.country) %></span> <span data-test-domain-overview-refdomains-item-ip><%= item.attributes.ip %></span></td>\n</tr>\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 = "<tr>\n <%= helper.displayBacklinksPagesLink(item.attributes) %>\n <td class=\"right\">\n\t\t<span data-test-domain-overview-pages-item-domains-count>\n\t\t<% if (item.attributes.source_url.length > 0 && item.attributes.domains_num > 0) { %>\n\t\t\t<a href=\"/analytics/backlinks/refdomains/<%- encodeURIComponent(item.attributes.source_url)%>:url\">\n\t\t\t\t<%= helper.breakToThreeComa(item.attributes.domains_num) %>\n\t\t\t</a>\n\t\t<% } else { %>\n\t\t\t<%= helper.breakToThreeComa(item.attributes.domains_num) %>\n\t\t<% } %>\n\t\t</span>\n </td>\n <td class=\"right\">\n\t\t<span data-test-domain-overview-pages-item-backlinks-count>\n <% if (item.attributes.source_url.length > 0 && item.attributes.backlinks_num > 0 ) { %>\n\t <a href=\"/analytics/backlinks/backlinks/<%- encodeURIComponent(item.attributes.source_url)%>:url\">\n\t <%= helper.breakToThreeComa(item.attributes.backlinks_num) %>\n\t </a>\n <% } else { %>\n <%= helper.breakToThreeComa(item.attributes.backlinks_num) %>\n <% } %>\n\t\t</span>\n </td>\n</tr>\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 = "<tr>\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<td>\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</td>\n</tr>\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 = "<tr>\n\t<%= helper.dispAdsLandings(item.get(\"targetUrl\")) %>\n\t<td><%= helper.breakToThreeComa(item.get(\"timesSeen\")) %></td>\n</tr>\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) { %>" + "<tr class=\"sem-widget-overview-info\">" + "<% data.each(function(item, countTr) { %>" + "<% if (countTr < 4) { %>" + this.template("tr") + "<% } %>" + "<% if (countTr < 3) { %>" + "<td><div style=\"width: 27px; display: block;\"></div></td>" + "<% } %>" + "<% }); %>" + "</tr>" + "<% } else { %>" + "<td<% if (typeof header !== \"undefined\" && header.length) { %>" + "colspan=\"<%= header.length %>\"<% } %> class=\"sem-widgets-no-results\"" + ">" + this.template("nothingFound") + "</td>" + "<% } %>";
- },
- 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 = "<td>\n\t<a href='<%= item.get(\"spa_url\") %>' target=\"_blank\" rel=\"nofollow noopener noreferrer\">\n\t <%= item.get(\"title\").replace(/<\\/a>.+/i, \"\") %>\n\t</a>\n\t<% if (item.get(\"visibleUrl\")) { %>\n\t<div class=\"sem-widget-type-ads-domain\" title=\"<%= item.get(\"Vu\") %>\"><span class=\"sem-report-block-ad\">Ad</span><%= item.get(\"visibleUrl\") %></div>\n\t<% } %>\n\t<div><%= item.get(\"text\")%></div>\n</td>"
- }
- , function(module, exports) {
- module.exports = "<td class=\"sem-report-block-adsense-media-td\">\n <a class=\"sem-report-block-adsense-media-ad\"\n href='<%= item.get(\"spa_url\") %>'\n target=\"_blank\" rel=\"nofollow noopener noreferrer\">\n <div><img src=\"<%= item.get('mediaUrl') %>\"/></div>\n </a>\n</td>"
- }
- , 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 '<div class="sem-report-legend-item index-' + this.index + '"><strong>' + this.percentage.toFixed(2) + '%</strong><br/>' + this.name + '</div>';
- },
- 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<div class=\"sem-report-block-row\">\n\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t<%= helper.roundNumRankFormatted(model.get(\"traffic\")) %>\n\t\t</div>\n\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t<div class=\"sem-report-header-td-diff <%= cssClass %>\"><%= sign + model.get(\"branded_diff\") %>%</div>\n\t\t</div>\n\t\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.traffic %></div>\n\t</div>\n\t<div class=\"report-delimiter\"></div>\n\t<table class=\"sem-report-block-summary-table\">\n\t\t<tr>\n\t\t\t<td><%= LOCALE.branded %></td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<span class=\"sem-report-counter\">\n\t\t\t\t\t<a href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + MIDDLE_WARE.domain_id + '+(by+organic)?filter=' + encodeURIComponent('+|Br|Eq|1') %>\">\n\t\t\t\t\t\t<%= helper.roundNumRank(model.get(\"keyword_branded\")) %>\n\t\t\t\t\t</a>\n\t\t\t\t</span>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\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 "<h3 class=\"sem-widget-header-title\">" + "<%= options.title %>" + "<%= (options.tooltip) ? ' <div class=\"sem-report-title-info sem-report-with-tooltip\"><div class=\"sem-report-title-info-description sem-report-tooltip-down\">' + options.tooltip + '</div></div>' : '' %>" + "</h3>";
- }
- },
- 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__));
- }
- ])
- });
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement