Skip to content

Commit d270135

Browse files
committed
Add sender for 7 day confirmed/unconfirmed
1 parent d15ad2e commit d270135

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

pir/pir-impl/src/main/java/com/duckduckgo/pir/impl/pixels/PirPixel.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,16 @@ enum class PirPixel(
140140
PIR_BROKER_CUSTOM_STATS_OPTOUT_SUBMIT_SUCCESSRATE(
141141
baseName = "dbp_databroker_custom_stats_optoutsubmit",
142142
type = Count,
143+
),
144+
145+
PIR_BROKER_CUSTOM_STATS_7DAY_CONFIRMED_OPTOUT(
146+
baseName = "dbp_optoutjob_at-7-days_confirmed",
147+
type = Count,
148+
),
149+
150+
PIR_BROKER_CUSTOM_STATS_7DAY_UNCONFIRMED_OPTOUT(
151+
baseName = "dbp_optoutjob_at-7-days_unconfirmed",
152+
type = Count,
143153
), ;
144154

145155
constructor(

pir/pir-impl/src/main/java/com/duckduckgo/pir/impl/pixels/PirPixelSender.kt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ package com.duckduckgo.pir.impl.pixels
1818

1919
import com.duckduckgo.app.statistics.pixels.Pixel
2020
import com.duckduckgo.di.scopes.AppScope
21+
import com.duckduckgo.pir.impl.pixels.PirPixel.PIR_BROKER_CUSTOM_STATS_7DAY_CONFIRMED_OPTOUT
22+
import com.duckduckgo.pir.impl.pixels.PirPixel.PIR_BROKER_CUSTOM_STATS_7DAY_UNCONFIRMED_OPTOUT
2123
import com.duckduckgo.pir.impl.pixels.PirPixel.PIR_BROKER_CUSTOM_STATS_OPTOUT_SUBMIT_SUCCESSRATE
2224
import com.duckduckgo.pir.impl.pixels.PirPixel.PIR_EMAIL_CONFIRMATION_ATTEMPT_FAILED
2325
import com.duckduckgo.pir.impl.pixels.PirPixel.PIR_EMAIL_CONFIRMATION_ATTEMPT_START
@@ -333,6 +335,16 @@ interface PirPixelSender {
333335
brokerUrl: String,
334336
optOutSuccessRate: Double,
335337
)
338+
339+
/**
340+
* Emits a pixel when an opt-out has been confirmed within 7 days.
341+
*/
342+
fun reportBrokerOptOutConfirmed7Days(brokerUrl: String)
343+
344+
/**
345+
* Emits a pixel when an opt-out is unconfirmed within 7 days.
346+
*/
347+
fun reportBrokerOptOutUnconfirmed7Days(brokerUrl: String)
336348
}
337349

338350
@ContributesBinding(AppScope::class)
@@ -627,6 +639,22 @@ class RealPirPixelSender @Inject constructor(
627639
fire(PIR_BROKER_CUSTOM_STATS_OPTOUT_SUBMIT_SUCCESSRATE, params)
628640
}
629641

642+
override fun reportBrokerOptOutConfirmed7Days(brokerUrl: String) {
643+
val params = mapOf(
644+
PARAM_KEY_BROKER to brokerUrl,
645+
)
646+
647+
fire(PIR_BROKER_CUSTOM_STATS_7DAY_CONFIRMED_OPTOUT, params)
648+
}
649+
650+
override fun reportBrokerOptOutUnconfirmed7Days(brokerUrl: String) {
651+
val params = mapOf(
652+
PARAM_KEY_BROKER to brokerUrl,
653+
)
654+
655+
fire(PIR_BROKER_CUSTOM_STATS_7DAY_UNCONFIRMED_OPTOUT, params)
656+
}
657+
630658
private fun fire(
631659
pixel: PirPixel,
632660
params: Map<String, String> = emptyMap(),

0 commit comments

Comments
 (0)