Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Bug 1815160 - Add sponsored story id to home_recs_spoc_shown and home…
Browse files Browse the repository at this point in the history
…_recs_spoc_clicked
  • Loading branch information
Alexandru2909 committed Feb 8, 2023
1 parent 9c51764 commit 4d588b2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6107,6 +6107,10 @@ pocket:
description: |
User tapped a Pocket sponsored story to be opened.
extra_keys:
spoc_id:
type: string
description: |
Id of the shown sponsored story.
times_shown:
type: string
description: |
Expand All @@ -6118,7 +6122,9 @@ pocket:
Uses the [row x column] matrix notation.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/25401
- https://bugzilla.mozilla.org/show_bug.cgi?id=1815160
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/28796#issuecomment-1422818844
- https://github.com/mozilla-mobile/fenix/pull/25418#issuecomment-1163390855
- https://github.com/mozilla-mobile/fenix/pull/26184#issuecomment-1194744884
data_sensitivity:
Expand Down Expand Up @@ -6157,6 +6163,10 @@ pocket:
A particular Pocket sponsored story was visible more than 50%
on the homescreen.
extra_keys:
spoc_id:
type: string
description: |
Id of the shown sponsored story.
times_shown:
type: string
description: |
Expand All @@ -6168,7 +6178,9 @@ pocket:
Uses the [row x column] matrix notation.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/25401
- https://bugzilla.mozilla.org/show_bug.cgi?id=1815160
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/28796#issuecomment-1422818844
- https://github.com/mozilla-mobile/fenix/pull/25418#issuecomment-1163390855
- https://github.com/mozilla-mobile/fenix/pull/26184#issuecomment-1194744884
data_sensitivity:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ internal class DefaultPocketStoriesController(
is PocketSponsoredStory -> {
Pocket.homeRecsSpocShown.record(
Pocket.HomeRecsSpocShownExtra(
spocId = storyShown.id.toString(),
position = "${storyPosition.first}x${storyPosition.second}",
timesShown = storyShown.getCurrentFlightImpressions().size.inc().toString(),
),
Expand Down Expand Up @@ -162,6 +163,7 @@ internal class DefaultPocketStoriesController(
is PocketSponsoredStory -> {
Pocket.homeRecsSpocClicked.record(
Pocket.HomeRecsSpocClickedExtra(
spocId = storyClicked.id.toString(),
position = "${storyPosition.first}x${storyPosition.second}",
timesShown = storyClicked.getCurrentFlightImpressions().size.inc().toString(),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class DefaultPocketStoriesControllerTest {
val storyShown: PocketSponsoredStory = mockk {
every { shim.click } returns "testClickShim"
every { shim.impression } returns "testImpressionShim"
every { id } returns 123
}
var wasPingSent = false
mockkStatic("mozilla.components.service.pocket.ext.PocketStoryKt") {
Expand All @@ -195,6 +196,7 @@ class DefaultPocketStoriesControllerTest {
assertNotNull(Pocket.homeRecsSpocShown.testGetValue())
assertEquals(1, Pocket.homeRecsSpocShown.testGetValue()!!.size)
val data = Pocket.homeRecsSpocShown.testGetValue()!!.single().extra
assertEquals("123", data?.entries?.first { it.key == "spoc_id" }?.value)
assertEquals("1x2", data?.entries?.first { it.key == "position" }?.value)
assertEquals("4", data?.entries?.first { it.key == "times_shown" }?.value)
assertTrue(wasPingSent)
Expand Down Expand Up @@ -279,6 +281,7 @@ class DefaultPocketStoriesControllerTest {
assertNotNull(Pocket.homeRecsSpocClicked.testGetValue())
assertEquals(1, Pocket.homeRecsSpocClicked.testGetValue()!!.size)
val data = Pocket.homeRecsSpocClicked.testGetValue()!!.single().extra
assertEquals("7", data?.entries?.first { it.key == "spoc_id" }?.value)
assertEquals("2x3", data?.entries?.first { it.key == "position" }?.value)
assertEquals("3", data?.entries?.first { it.key == "times_shown" }?.value)
assertTrue(wasPingSent)
Expand Down

0 comments on commit 4d588b2

Please sign in to comment.