Skip to content

Commit 645b821

Browse files
authored
Merge pull request #773 from waiterZen/SERVER-1208
[sources] add source character limitation config & process
2 parents 691f33a + 576cd96 commit 645b821

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

plugins/sources/api/api.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ var utmTags = ["_ga", "_gac", "utm_source", "utm_medium", "utm_campaign", "utm_t
2222

2323

2424
(function(plugin) {
25+
plugins.setConfigs("sources", {
26+
sources_length_limit: 100
27+
});
28+
2529
plugin.urlParser = function(url) {
2630
var qIndex = url.indexOf("?");
2731
var path = qIndex > 0 ? url.substring(0, qIndex) : url;
@@ -89,8 +93,6 @@ var utmTags = ["_ga", "_gac", "utm_source", "utm_medium", "utm_campaign", "utm_t
8993
return processedURL;
9094
};
9195

92-
93-
9496
plugins.register("/worker", function() {
9597
common.dbUserMap.source = 'src';
9698
});
@@ -101,6 +103,7 @@ var utmTags = ["_ga", "_gac", "utm_source", "utm_medium", "utm_campaign", "utm_t
101103
var predefinedMetrics = ob.predefinedMetrics;
102104
var params = ob.params;
103105
var user = ob.user;
106+
104107
if (params.qstring.metrics && (!user || typeof user[common.dbUserMap.source] === "undefined")) {
105108
if (typeof params.qstring.metrics._store === "undefined" && params.qstring.metrics._os) {
106109
params.qstring.metrics._store = params.qstring.metrics._os;
@@ -113,7 +116,9 @@ var utmTags = ["_ga", "_gac", "utm_source", "utm_medium", "utm_campaign", "utm_t
113116
}
114117
params.qstring.metrics._store = common.db.encode(params.qstring.metrics._store);
115118
}
116-
119+
var sourcesConfig = plugins.getConfig("sources", params.app && params.app.plugins, true) || {};
120+
var sources_length_limit = (sourcesConfig.sources_length_limit && parseInt(sourcesConfig.sources_length_limit, 10)) || 100;
121+
params.qstring.metrics._store = params.qstring.metrics._store.substring(0, sources_length_limit);
117122
predefinedMetrics.push({
118123
db: "sources",
119124
metrics: [

plugins/sources/frontend/public/javascripts/countly.views.js

+4
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,8 @@ $(document).ready(function() {
251251
'<div class="text" data-localize="keywords.title"></div>' +
252252
'</a>';
253253
$('#web-type #analytics-submenu').append(menu2);
254+
if(app.configurationsView){
255+
app.configurationsView.registerLabel("sources", "sources.source");
256+
app.configurationsView.registerLabel("sources.sources_length_limit", "sources.length_limit");
257+
}
254258
});

plugins/sources/frontend/public/localization/sources.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ sources.description = Display sources (appstores or referring pages) of your use
44
sources.source = Source
55
sources.direct = Direct
66
sources.organic = Organic
7+
sources.length_limit = Characters length limitation for sources
8+
configs.help.sources-sources_length_limit = The characters beyond the limitation value will be ignored
79
help.sources.chart = Pie chart on the left shows total visitors from each source (referral URL). Pie chart on the right shows new visitors from each source. The table below shows a breakdown of this data for each source. Click on each line on a table to see a list of paths.
8-
910
#keywords
1011
keywords.title = Search terms

0 commit comments

Comments
 (0)