You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//// Track when an item converts (a.k.a. is added to cart) regardless of the user journey that led to adding to cart (itemName, customerId, revenue, searchTerm)
// Track when an item converts (a.k.a. is added to cart) regardless of the user journey that led to adding to cart (itemName, customerId, revenue, searchTerm, section, conversionType)
val requestBodyString = request.body.readUtf8().drop(1).dropLast(1).replace("\"", "")
24
+
val requestBodyList =ArrayList(requestBodyString.split(","))
25
+
return requestBodyList.associate {
26
+
val (key, value) = it.split(":")
27
+
key to value
28
+
}
29
+
}
30
+
21
31
classConstructorIoTrackingTest {
22
32
23
33
@Rule
@@ -299,7 +309,26 @@ class ConstructorIoTrackingTest {
299
309
val observer =ConstructorIo.trackConversionInternal("titanic replica", "TIT-REP-1997", 89.00).test()
300
310
observer.assertComplete()
301
311
val request = mockServer.takeRequest()
302
-
val path ="/autocomplete/TERM_UNKNOWN/conversion?name=titanic%20replica&customer_id=TIT-REP-1997&revenue=89.00§ion=Products&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.5.2&_dt=";
312
+
val path ="/v2/behavioral_action/conversion?key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.5.2&_dt=";
313
+
assert(request.path.startsWith(path))
314
+
assertTrue(request.bodySize >220)
315
+
assertEquals("POST", request.method)
316
+
}
317
+
318
+
@Test
319
+
funtrackConversionWithConversionType() {
320
+
val mockResponse =MockResponse().setResponseCode(204)
321
+
mockServer.enqueue(mockResponse)
322
+
val observer =ConstructorIo.trackConversionInternal("titanic replica", "TIT-REP-1997", 89.00, "titanic", "Products", "Like").test()
323
+
observer.assertComplete()
324
+
val request = mockServer.takeRequest()
325
+
val requestBody = getRequestBody(request)
326
+
val path ="/v2/behavioral_action/conversion?key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.5.2&_dt=";
@@ -310,8 +339,10 @@ class ConstructorIoTrackingTest {
310
339
val observer =ConstructorIo.trackConversionInternal("titanic replica", "TIT-REP-1997", 89.00).test()
311
340
observer.assertError { true }
312
341
val request = mockServer.takeRequest()
313
-
val path ="/autocomplete/TERM_UNKNOWN/conversion?name=titanic%20replica&customer_id=TIT-REP-1997&revenue=89.00§ion=Products&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.5.2&_dt=";
342
+
val path ="/v2/behavioral_action/conversion?key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.5.2&_dt=";
314
343
assert(request.path.startsWith(path))
344
+
assertTrue(request.bodySize >220)
345
+
assertEquals("POST", request.method)
315
346
}
316
347
317
348
@Test
@@ -321,9 +352,8 @@ class ConstructorIoTrackingTest {
321
352
mockServer.enqueue(mockResponse)
322
353
val observer =ConstructorIo.trackConversionInternal("titanic replica", "TIT-REP-1997", 89.00).test()
val path ="/autocomplete/TERM_UNKNOWN/conversion?name=titanic%20replica&customer_id=TIT-REP-1997&revenue=89.00§ion=Products&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.5.2&_dt=";
326
-
assert(request.path.startsWith(path))
355
+
val request = mockServer.takeRequest(10, TimeUnit.SECONDS)
356
+
assertEquals(null, request)
327
357
}
328
358
329
359
@Test
@@ -380,7 +410,7 @@ class ConstructorIoTrackingTest {
380
410
val observer =ConstructorIo.trackBrowseResultsLoadedInternal("group_id", "Movies", 10).test()
381
411
observer.assertComplete()
382
412
val request = mockServer.takeRequest()
383
-
val path ="/v2/behavioral_action/browse_result_load?section=Products&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.5.2&_dt="
413
+
val path ="/v2/behavioral_action/browse_result_load?key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.5.2&_dt="
384
414
assert(request.path.startsWith(path))
385
415
assertTrue(request.bodySize >215)
386
416
assertEquals("POST", request.method)
@@ -393,7 +423,7 @@ class ConstructorIoTrackingTest {
393
423
val observer =ConstructorIo.trackBrowseResultsLoadedInternal("group_id", "Movies", 10).test()
394
424
observer.assertError { true }
395
425
val request = mockServer.takeRequest()
396
-
val path ="/v2/behavioral_action/browse_result_load?section=Products&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.5.2&_dt="
426
+
val path ="/v2/behavioral_action/browse_result_load?key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.5.2&_dt="
Copy file name to clipboardExpand all lines: library/src/test/java/io/constructor/core/ConstructorioSegmentsTest.kt
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -140,7 +140,7 @@ class ConstructorioSegmentsTest {
140
140
val observer =ConstructorIo.trackConversionInternal("titanic replica", "TIT-REP-1997", 89.00).test()
141
141
observer.assertComplete()
142
142
val request = mockServer.takeRequest()
143
-
val path ="/autocomplete/TERM_UNKNOWN/conversion?name=titanic%20replica&customer_id=TIT-REP-1997&revenue=89.00§ion=Products&key=aluminium-key&i=koopa-the-guid&ui=player-two&s=14&us=mobile&us=COUNTRY_US&c=cioand-2.5.2&_dt=";
143
+
val path ="/v2/behavioral_action/conversion?key=aluminium-key&i=koopa-the-guid&ui=player-two&s=14&us=mobile&us=COUNTRY_US&c=cioand-2.5.2&_dt=";
Copy file name to clipboardExpand all lines: library/src/test/java/io/constructor/core/ConstructorioTestCellTest.kt
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -141,7 +141,7 @@ class ConstructorioTestCellTest {
141
141
val observer =ConstructorIo.trackConversionInternal("titanic replica", "TIT-REP-1997", 89.00).test()
142
142
observer.assertComplete()
143
143
val request = mockServer.takeRequest()
144
-
val path ="/autocomplete/TERM_UNKNOWN/conversion?name=titanic%20replica&customer_id=TIT-REP-1997&revenue=89.00§ion=Products&key=aluminium-key&i=koopa-the-guid&ui=player-two&s=14&ef-cellone=vanilla&ef-celltwo=whipped-cream&c=cioand-2.5.2&_dt=";
144
+
val path ="/v2/behavioral_action/conversion?key=aluminium-key&i=koopa-the-guid&ui=player-two&s=14&ef-cellone=vanilla&ef-celltwo=whipped-cream&c=cioand-2.5.2&_dt=";
0 commit comments