Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Create Analytics module#11

Merged
hamorillo merged 12 commits intotrunkfrom
hamorillo/GRA-184
Jun 23, 2025
Merged

Create Analytics module#11
hamorillo merged 12 commits intotrunkfrom
hamorillo/GRA-184

Conversation

@hamorillo
Copy link

@hamorillo hamorillo commented Jun 17, 2025

Description

This PR creates a new module (analytics) to encapsulate the code related to analytic events. Track library doesn't have a userType for Gravatar, so I've opened a PR to add it. (We'll need to update our app when the PR is merged and the new release is published.)

If we agree to merge this PR, I'll create a ticket to ensure we don't forget about it.

Testing Steps

  • I've added a "test" event in the viewmodel that we'll need to remove when we have a clear idea about what event we want to track. Launching the app and filtering tracks by gravatarandroid% should be enough to verify that the event is being sent to the backend. Another option could be to verify that the device makes the network request.

Note: The event takes some time to appear in Tracks. Based on my experience, it could take more than 15 minutes.


override fun trackEvent(event: Event) {
// We should add GRAVATAR userType when available.
tracksClient.track(event.name, userId ?: anonId, TracksClient.NosaraUserType.ANON)
Copy link
Author

Choose a reason for hiding this comment

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

We should refactor the code when NosaraUserType.GRAVATAR is available.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know when we will have it?

Copy link
Author

Choose a reason for hiding this comment

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

Not yet. If there are no changes in the PR today, I'll ask for the review and an estimated time for the new release.

@hamorillo hamorillo force-pushed the hamorillo/GRA-184 branch from 55ea667 to 99e6d4f Compare June 17, 2025 19:31
@Suppress("FunctionOnlyReturningConstant")
fun getName(): String {
return "Gravatar"
val userId = "Gravatar"
Copy link
Author

Choose a reason for hiding this comment

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

This hardcoded Gravatar should be replaced with the Gravatar UserID when we implement the OAuth flow.

Copy link
Author

Choose a reason for hiding this comment

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

Update: We'll need to use the WPCOM userName here.

@hamorillo hamorillo marked this pull request as ready for review June 17, 2025 20:52
Copy link
Contributor

@AdamGrzybkowski AdamGrzybkowski left a comment

Choose a reason for hiding this comment

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

Looks good 👍 Left some clarifying comments.

package com.gravatar.analytics

interface Event {
val name: String
Copy link
Contributor

Choose a reason for hiding this comment

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

We will likely need a way to pass some params as well.

@hamorillo hamorillo force-pushed the hamorillo/GRA-184 branch from 3873000 to 93412be Compare June 18, 2025 13:20
Copy link
Contributor

@AdamGrzybkowski AdamGrzybkowski left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thanks for all the updates!

@hamorillo hamorillo merged commit 7a7602c into trunk Jun 23, 2025
7 checks passed
@hamorillo hamorillo deleted the hamorillo/GRA-184 branch June 23, 2025 11:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants