File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ function utm(query) {
17
17
if ( utmParam === 'campaign' ) {
18
18
utmParam = 'name'
19
19
}
20
- acc [ utmParam ] = v
20
+ acc [ utmParam ] = decodeURIComponent ( v . replace ( / \+ / g , ' ' ) )
21
21
}
22
22
}
23
23
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @segment/analytics.js-integration-segmentio" ,
3
3
"description" : " The Segmentio analytics.js integration." ,
4
- "version" : " 4.4.4 " ,
4
+ "version" : " 4.4.5 " ,
5
5
"keywords" : [
6
6
" analytics.js" ,
7
7
" analytics.js-integration" ,
Original file line number Diff line number Diff line change @@ -241,6 +241,18 @@ describe('Segment.io', function() {
241
241
Segment . global = window ;
242
242
} ) ;
243
243
244
+ it ( 'should decode .campaign' , function ( ) {
245
+ Segment . global = { navigator : { } , location : { } } ;
246
+ Segment . global . location . search =
247
+ '?utm_source=%5BFoo%5D' ;
248
+ segment . normalize ( object ) ;
249
+ analytics . assert ( object ) ;
250
+ analytics . assert ( object . context ) ;
251
+ analytics . assert ( object . context . campaign ) ;
252
+ analytics . assert ( object . context . campaign . source === '[Foo]' ) ;
253
+ Segment . global = window ;
254
+ } ) ;
255
+
244
256
it ( 'should allow override of .campaign' , function ( ) {
245
257
Segment . global = { navigator : { } , location : { } } ;
246
258
Segment . global . location . search =
You can’t perform that action at this time.
0 commit comments