Skip to content

Commit 9723501

Browse files
authored
[CSL 235] Remove action from browse url query params (#62)
* Add section to browse result load, remove action * Pass section to body
1 parent 47a743e commit 9723501

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

library/src/main/java/io/constructor/core/Constants.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class Constants {
4848
const val SEARCH_SUGGESTIONS = "Search Suggestions"
4949
const val PRODUCTS = "Products"
5050
const val EVENT_SEARCH_RESULTS = "search-results"
51-
const val EVENT_BROWSE_RESULTS = "browse-results"
5251
const val EVENT_INPUT_FOCUS = "focus"
5352
}
5453
}

library/src/main/java/io/constructor/core/ConstructorIo.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,15 @@ object ConstructorIo {
367367
* @param filterValue the value of the primary filter, i.e. "Produce"
368368
* @param resultCount the number of results for that filter name/value pair
369369
*/
370-
fun trackBrowseResultsLoaded(filterName: String, filterValue: String, resultCount: Int, url: String = "Not Available") {
371-
var completable = trackBrowseResultsLoadedInternal(filterName, filterValue, resultCount, url)
370+
fun trackBrowseResultsLoaded(filterName: String, filterValue: String, resultCount: Int, sectionName: String? = null, url: String = "Not Available") {
371+
var completable = trackBrowseResultsLoadedInternal(filterName, filterValue, resultCount, sectionName, url)
372372
disposable.add(completable.subscribeOn(Schedulers.io()).subscribe({}, {
373373
t -> e("Browse Results Loaded error: ${t.message}")
374374
}))
375375
}
376-
internal fun trackBrowseResultsLoadedInternal(filterName: String, filterValue: String, resultCount: Int, url: String = "Not Available"): Completable {
376+
internal fun trackBrowseResultsLoadedInternal(filterName: String, filterValue: String, resultCount: Int, sectionName: String? = null, url: String = "Not Available"): Completable {
377377
preferenceHelper.getSessionId(sessionIncrementHandler)
378+
val section = sectionName ?: preferenceHelper.defaultItemSection
378379
val browseResultLoadRequestBody = BrowseResultLoadRequestBody(
379380
filterName,
380381
filterValue,
@@ -387,13 +388,13 @@ object ConstructorIo {
387388
configMemoryHolder.userId,
388389
configMemoryHolder.segments,
389390
true,
390-
preferenceHelper.defaultItemSection,
391+
section,
391392
System.currentTimeMillis()
392393
)
393394

394395
return dataManager.trackBrowseResultsLoaded(
395396
browseResultLoadRequestBody,
396-
arrayOf(Constants.QueryConstants.ACTION to Constants.QueryValues.EVENT_BROWSE_RESULTS)
397+
arrayOf(Constants.QueryConstants.SECTION to section)
397398
)
398399
}
399400

library/src/test/java/io/constructor/core/ConstructorIoTrackingTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ class ConstructorIoTrackingTest {
380380
val observer = ConstructorIo.trackBrowseResultsLoadedInternal("group_id", "Movies", 10).test()
381381
observer.assertComplete()
382382
val request = mockServer.takeRequest()
383-
val path = "/v2/behavioral_action/browse_result_load?action=browse-results&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.5.0&_dt="
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.0&_dt="
384384
assert(request.path.startsWith(path))
385385
assertTrue(request.bodySize > 215)
386386
assertEquals("POST", request.method)
@@ -393,7 +393,7 @@ class ConstructorIoTrackingTest {
393393
val observer = ConstructorIo.trackBrowseResultsLoadedInternal("group_id", "Movies", 10).test()
394394
observer.assertError { true }
395395
val request = mockServer.takeRequest()
396-
val path = "/v2/behavioral_action/browse_result_load?action=browse-results&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.5.0&_dt="
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.0&_dt="
397397
assert(request.path.startsWith(path))
398398
assertTrue(request.bodySize > 220)
399399
assertEquals("POST", request.method)

0 commit comments

Comments
 (0)