Skip to content

Conversation

cmonfortep
Copy link
Contributor

@cmonfortep cmonfortep commented Oct 3, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/project/1202552961248957/task/1211500171306010?focus=true

Description

Scope

  • Create attributed-metrics module
  • Add database to store events
  • Connect with FF: enable/disable client
  • Connect with Atb, privacy config
  • Handles initialization and returning users checks
  • Handles expiry date to disable client

Steps to test this PR

While testing this PR you need to add the following in your logcat filter:
tag~:"AttributedMetrics"

Feature 1

  • We need fresh install (including removing DDG folder in file system)
  • open the app
  • wait for privacy config download, since we need atb init
  • Detected new install not reinstall Log: New install detected, attributed metrics active
  • Log: Client status running: true...
  • Skip onboarding and go to browser
  • Access feature flag inventory
  • Disable attributedMetrics FF
  • restart the app
  • See in the log Privacy config downloaded, attributed metrics enabled: false (that should disable the client)
  • and log Client status running: false -> isActive: true, isEnabled: false...

Feature 2

  • fresh install but keep DDG folder
  • open the app
  • wait for privacy config download, since we need atb init
  • check logs for App reinstall detected, attributed metrics will not be active
  • and Client status running: false -> isActive: false, isEnabled: true...

UI changes

Before After
!(Upload before screenshot) (Upload after screenshot)

@cmonfortep
Copy link
Contributor Author

cmonfortep commented Oct 3, 2025

@cmonfortep cmonfortep force-pushed the feature/cristian/attributed_metrics_module branch from 3309dae to 54292a7 Compare October 3, 2025 15:18
eventRepository.getEventStats(eventName, days)
}

// TODO: Pending adding default attributed metrics and removing default prefix from pixel names
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will happen on future PRs

@cmonfortep cmonfortep force-pushed the feature/cristian/attributed_metrics_module branch from 54292a7 to fe91bc1 Compare October 3, 2025 15:48
@cmonfortep cmonfortep force-pushed the feature/cristian/attributed_metrics_module branch from e6b6bc4 to 831e0ec Compare October 7, 2025 13:09
@cmonfortep cmonfortep force-pushed the feature/cristian/attributed_metrics_module branch from 831e0ec to c8c63fb Compare October 7, 2025 18:13
Copy link
Contributor

@marcosholgado marcosholgado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left a few comments

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I don't think we need the baseline file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was needed, lint failed and I had to create the baseline.

generateDaggerFactories = true // default is false
}
lintOptions {
baseline file("lint-baseline.xml")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: don't think we need this since there are no linting issues

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto


package com.duckduckgo.app.attributed.metrics

internal interface AttributedMetricsState {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda confused by this, you also have another AttributedMetricsState but with isActive... maybe the fact that the interface name is the same? Also not sure if this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be removed, leftover when refactoring some code. It got replaced by the other one with same name.


@ContributesBinding(AppScope::class)
class RealAttributedMetricsDateUtils @Inject constructor() : AttributedMetricsDateUtils {
override fun getCurrentDate(): String = getCurrentLocalDate().format(DATE_FORMATTER)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we say to use ET? Can't really remember but it rings a bell.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't store time, just date. So this is just storing events on the device date. You mentioned ET time in one kickoff project, but we didn't discuss that further and I haven't considered that.
Trying to reason this, I believe what you say is: a user can install the app, and in their same day, they can receive 2 different atb because it's calculated by ET time, even for the user is same day. Is that correct? I can take that offline and revisit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


@Dao
interface EventDao {
@Transaction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this one a transaction? I find it weird to have one on a normal query.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@cmonfortep cmonfortep force-pushed the feature/cristian/attributed_metrics_module branch from 0602cd7 to 1e2a8db Compare October 8, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants