@@ -59,36 +59,40 @@ var countlyEvents = {},
59
59
60
60
for ( var segKey in currEvent . segmentation ) {
61
61
62
+ if ( plugins . internalOmitSegments [ currEvent . key ] && Array . isArray ( plugins . internalOmitSegments [ currEvent . key ] ) && plugins . internalOmitSegments [ currEvent . key ] . indexOf ( segKey ) != - 1 ) //check if segment should be ommited
63
+ {
64
+ continue ;
65
+ }
66
+
62
67
if ( omitted_segments [ currEvent . key ] && Array . isArray ( omitted_segments [ currEvent . key ] ) && omitted_segments [ currEvent . key ] . indexOf ( segKey ) != - 1 ) //check if segment should be ommited
63
68
{
64
69
continue ;
65
70
}
66
71
72
+ if ( plugins . getConfig ( "api" ) . event_segmentation_limit &&
73
+ appSegments [ currEvent . key ] &&
74
+ appSegments [ currEvent . key ] . indexOf ( segKey ) === - 1 &&
75
+ appSegments [ currEvent . key ] . length >= plugins . getConfig ( "api" ) . event_segmentation_limit ) {
76
+ continue ;
77
+ }
67
78
68
- if ( plugins . getConfig ( "api" ) . event_segmentation_limit &&
69
- appSegments [ currEvent . key ] &&
70
- appSegments [ currEvent . key ] . indexOf ( segKey ) === - 1 &&
71
- appSegments [ currEvent . key ] . length >= plugins . getConfig ( "api" ) . event_segmentation_limit ) {
72
- continue ;
73
- }
74
-
75
- var tmpSegVal = currEvent . segmentation [ segKey ] + "" ;
79
+ var tmpSegVal = currEvent . segmentation [ segKey ] + "" ;
76
80
77
- if ( tmpSegVal == "" ) {
78
- continue ;
79
- }
81
+ if ( tmpSegVal == "" ) {
82
+ continue ;
83
+ }
80
84
81
- // Mongodb field names can't start with $ or contain .
82
- tmpSegVal = tmpSegVal . replace ( / ^ \$ / , "" ) . replace ( / \. / g, ":" ) ;
85
+ // Mongodb field names can't start with $ or contain .
86
+ tmpSegVal = tmpSegVal . replace ( / ^ \$ / , "" ) . replace ( / \. / g, ":" ) ;
83
87
84
- if ( forbiddenSegValues . indexOf ( tmpSegVal ) !== - 1 ) {
85
- tmpSegVal = "[CLY]" + tmpSegVal ;
86
- }
87
- var postfix = common . crypto . createHash ( "md5" ) . update ( tmpSegVal ) . digest ( 'base64' ) [ 0 ] ;
88
- metaToFetch [ eventCollectionName + "no-segment_" + common . getDateIds ( params ) . zero + "_" + postfix ] = {
89
- coll : eventCollectionName ,
90
- id : "no-segment_" + common . getDateIds ( params ) . zero + "_" + postfix
91
- } ;
88
+ if ( forbiddenSegValues . indexOf ( tmpSegVal ) !== - 1 ) {
89
+ tmpSegVal = "[CLY]" + tmpSegVal ;
90
+ }
91
+ var postfix = common . crypto . createHash ( "md5" ) . update ( tmpSegVal ) . digest ( 'base64' ) [ 0 ] ;
92
+ metaToFetch [ eventCollectionName + "no-segment_" + common . getDateIds ( params ) . zero + "_" + postfix ] = {
93
+ coll : eventCollectionName ,
94
+ id : "no-segment_" + common . getDateIds ( params ) . zero + "_" + postfix
95
+ } ;
92
96
93
97
}
94
98
}
@@ -207,59 +211,64 @@ var countlyEvents = {},
207
211
}
208
212
209
213
for ( var segKey in currEvent . segmentation ) {
214
+ if ( plugins . internalOmitSegments [ currEvent . key ] && Array . isArray ( plugins . internalOmitSegments [ currEvent . key ] ) && plugins . internalOmitSegments [ currEvent . key ] . indexOf ( segKey ) != - 1 ) //check if segment should be ommited
215
+ {
216
+ continue ;
217
+ }
218
+
210
219
if ( omitted_segments [ currEvent . key ] && Array . isArray ( omitted_segments [ currEvent . key ] ) && omitted_segments [ currEvent . key ] . indexOf ( segKey ) != - 1 ) //check if segment should be ommited
211
220
{
212
221
continue ;
213
222
}
214
223
215
- if ( plugins . getConfig ( "api" ) . event_segmentation_limit &&
216
- appSegments [ currEvent . key ] &&
217
- appSegments [ currEvent . key ] . indexOf ( segKey ) === - 1 &&
218
- appSegments [ currEvent . key ] . length >= plugins . getConfig ( "api" ) . event_segmentation_limit ) {
219
- continue ;
220
- }
224
+ if ( plugins . getConfig ( "api" ) . event_segmentation_limit &&
225
+ appSegments [ currEvent . key ] &&
226
+ appSegments [ currEvent . key ] . indexOf ( segKey ) === - 1 &&
227
+ appSegments [ currEvent . key ] . length >= plugins . getConfig ( "api" ) . event_segmentation_limit ) {
228
+ continue ;
229
+ }
221
230
222
- tmpEventObj = { } ;
223
- var tmpSegVal = currEvent . segmentation [ segKey ] + "" ;
231
+ tmpEventObj = { } ;
232
+ var tmpSegVal = currEvent . segmentation [ segKey ] + "" ;
224
233
225
- if ( tmpSegVal == "" ) {
226
- continue ;
227
- }
234
+ if ( tmpSegVal == "" ) {
235
+ continue ;
236
+ }
228
237
229
- // Mongodb field names can't start with $ or contain .
230
- tmpSegVal = tmpSegVal . replace ( / ^ \$ / , "" ) . replace ( / \. / g, ":" ) ;
238
+ // Mongodb field names can't start with $ or contain .
239
+ tmpSegVal = tmpSegVal . replace ( / ^ \$ / , "" ) . replace ( / \. / g, ":" ) ;
231
240
232
- if ( forbiddenSegValues . indexOf ( tmpSegVal ) !== - 1 ) {
233
- tmpSegVal = "[CLY]" + tmpSegVal ;
234
- }
235
-
236
- var postfix = common . crypto . createHash ( "md5" ) . update ( tmpSegVal ) . digest ( 'base64' ) [ 0 ] ;
237
-
238
- if ( plugins . getConfig ( "api" ) . event_segmentation_value_limit &&
239
- appSgValues [ eventCollectionName ] &&
240
- appSgValues [ eventCollectionName ] [ "no-segment" + "_" + dateIds . zero + "_" + postfix ] &&
241
- appSgValues [ eventCollectionName ] [ "no-segment" + "_" + dateIds . zero + "_" + postfix ] [ segKey ] &&
242
- appSgValues [ eventCollectionName ] [ "no-segment" + "_" + dateIds . zero + "_" + postfix ] [ segKey ] . indexOf ( tmpSegVal ) === - 1 &&
243
- appSgValues [ eventCollectionName ] [ "no-segment" + "_" + dateIds . zero + "_" + postfix ] [ segKey ] . length >= plugins . getConfig ( "api" ) . event_segmentation_value_limit ) {
244
- continue ;
245
- }
241
+ if ( forbiddenSegValues . indexOf ( tmpSegVal ) !== - 1 ) {
242
+ tmpSegVal = "[CLY]" + tmpSegVal ;
243
+ }
244
+
245
+ var postfix = common . crypto . createHash ( "md5" ) . update ( tmpSegVal ) . digest ( 'base64' ) [ 0 ] ;
246
+
247
+ if ( plugins . getConfig ( "api" ) . event_segmentation_value_limit &&
248
+ appSgValues [ eventCollectionName ] &&
249
+ appSgValues [ eventCollectionName ] [ "no-segment" + "_" + dateIds . zero + "_" + postfix ] &&
250
+ appSgValues [ eventCollectionName ] [ "no-segment" + "_" + dateIds . zero + "_" + postfix ] [ segKey ] &&
251
+ appSgValues [ eventCollectionName ] [ "no-segment" + "_" + dateIds . zero + "_" + postfix ] [ segKey ] . indexOf ( tmpSegVal ) === - 1 &&
252
+ appSgValues [ eventCollectionName ] [ "no-segment" + "_" + dateIds . zero + "_" + postfix ] [ segKey ] . length >= plugins . getConfig ( "api" ) . event_segmentation_value_limit ) {
253
+ continue ;
254
+ }
246
255
247
- if ( currEvent . sum && common . isNumber ( currEvent . sum ) ) {
248
- common . fillTimeObjectMonth ( params , tmpEventObj , tmpSegVal + '.' + common . dbMap [ 'sum' ] , currEvent . sum ) ;
249
- }
250
-
251
- if ( currEvent . dur && common . isNumber ( currEvent . dur ) ) {
252
- common . fillTimeObjectMonth ( params , tmpEventObj , tmpSegVal + '.' + common . dbMap [ 'dur' ] , currEvent . dur ) ;
253
- }
256
+ if ( currEvent . sum && common . isNumber ( currEvent . sum ) ) {
257
+ common . fillTimeObjectMonth ( params , tmpEventObj , tmpSegVal + '.' + common . dbMap [ 'sum' ] , currEvent . sum ) ;
258
+ }
259
+
260
+ if ( currEvent . dur && common . isNumber ( currEvent . dur ) ) {
261
+ common . fillTimeObjectMonth ( params , tmpEventObj , tmpSegVal + '.' + common . dbMap [ 'dur' ] , currEvent . dur ) ;
262
+ }
254
263
255
- common . fillTimeObjectMonth ( params , tmpEventObj , tmpSegVal + '.' + common . dbMap [ 'count' ] , currEvent . count ) ;
264
+ common . fillTimeObjectMonth ( params , tmpEventObj , tmpSegVal + '.' + common . dbMap [ 'count' ] , currEvent . count ) ;
256
265
257
- if ( ! eventSegmentsZeroes [ eventCollectionName ] ) {
258
- eventSegmentsZeroes [ eventCollectionName ] = [ ] ;
259
- common . arrayAddUniq ( eventSegmentsZeroes [ eventCollectionName ] , dateIds . zero + "." + postfix ) ;
260
- } else {
261
- common . arrayAddUniq ( eventSegmentsZeroes [ eventCollectionName ] , dateIds . zero + "." + postfix ) ;
262
- }
266
+ if ( ! eventSegmentsZeroes [ eventCollectionName ] ) {
267
+ eventSegmentsZeroes [ eventCollectionName ] = [ ] ;
268
+ common . arrayAddUniq ( eventSegmentsZeroes [ eventCollectionName ] , dateIds . zero + "." + postfix ) ;
269
+ } else {
270
+ common . arrayAddUniq ( eventSegmentsZeroes [ eventCollectionName ] , dateIds . zero + "." + postfix ) ;
271
+ }
263
272
264
273
if ( ! eventSegments [ eventCollectionName + "." + dateIds . zero + "." + postfix ] ) {
265
274
eventSegments [ eventCollectionName + "." + dateIds . zero + "." + postfix ] = { } ;
0 commit comments