Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

fix(posts): Post Button interactions (Like, Boost, Respond, Share, Report) [MOSOWEB-44] #75

Merged
merged 24 commits into from
Nov 8, 2023

Conversation

jpezninjo
Copy link

@jpezninjo jpezninjo commented Oct 31, 2023

Goal

Adding glean events for Post Button interactions (Like, Boost, Respond, Share, Report)
MOSOWEB-44

To Do:

  • Add glean event for a generic "reply" event
  • Add sending mastodon_post_id
  • Add glean event for "home.reply" to set up pattern for different feeds
  • Do the rest of the post actions - boost, like, bookmark, reply
  • Do the rest of the feeds - favorites, likes, local, federated

I'd love feedback/perspectives on:

  • Did I miss any other feeds?

  • Should I rename "post.reblog" to "post.boost" to match the engagement_type?

"ui_identifier": "post.reblog",
"mastodon_status_id": "111330231322029109",
"engagement_type": "boost"

Implementation Decisions

The feed names are defined in the "Timeline" components. I did some light prop drilling instead of doing something involving the page URL.

For example, here's Home

<TimelineHome feedName="home.feed">
    <TimelinePaginator feedName>
        <StatusCard feedName>
            <StatusActionsMore feedName>     <--- Report
            <StatusActions feedName>         <--- Like/boost/reply/bookmark

Obligatory list of new events

5 action types, multiplied by the 4 feeds + standalone page

// Standalone post
post.open-reply
post.reblog
post.unreblog
post.favourite
post.unfavourite
post.bookmark
post.unbookmark
post.report
// Account feed
account.feed.post.open-reply
account.feed.post.reblog
account.feed.post.unreblog
account.feed.post.favourite
account.feed.post.unfavourite
account.feed.post.bookmark
account.feed.post.unbookmark
account.feed.post.report
// Home feed
home.feed.post.open-reply
home.feed.post.reblog
home.feed.post.unreblog
home.feed.post.favourite
home.feed.post.unfavourite
home.feed.post.bookmark
home.feed.post.unbookmark
home.feed.post.report
// Favorites feed
favorites.feed.post.open-reply
favorites.feed.post.reblog
favorites.feed.post.unreblog
favorites.feed.post.favourite
favorites.feed.post.unfavourite
favorites.feed.post.bookmark
favorites.feed.post.unbookmark
favorites.feed.post.report
// Bookmarks feed
bookmarks.feed.post.open-reply
bookmarks.feed.post.reblog
bookmarks.feed.post.unreblog
bookmarks.feed.post.favourite
bookmarks.feed.post.unfavourite
bookmarks.feed.post.bookmark
bookmarks.feed.post.unbookmark
bookmarks.feed.post.report
// Local feed
local.feed.post.open-reply
local.feed.post.reblog
local.feed.post.unreblog
local.feed.post.favourite
local.feed.post.unfavourite
local.feed.post.bookmark
local.feed.post.unbookmark
local.feed.post.report
// Federated feed
federated.feed.post.open-reply
federated.feed.post.reblog
federated.feed.post.unreblog
federated.feed.post.favourite
federated.feed.post.unfavourite
federated.feed.post.bookmark
federated.feed.post.unbookmark
federated.feed.post.report

@jpezninjo jpezninjo requested a review from a team as a code owner October 31, 2023 00:07
toggleReblog()
}

function favourite() {
Copy link
Author

@jpezninjo jpezninjo Oct 31, 2023

Choose a reason for hiding this comment

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

using the UK English version of "favorite" to match the called toggleFavourite, even though there's a useStarFavoriteIcon elsewhere in this file 😠

Choose a reason for hiding this comment

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

grumble grumble, i really dislike that these have been mixed throughout the entire repo but one problem at a time i suppose

@jpezninjo jpezninjo changed the title [draft] fix(posts): Post Button interactions (Like, Boost, Respond, Share, Report) [MOSOWEB-44] fix(posts): Post Button interactions (Like, Boost, Respond, Share, Report) [MOSOWEB-44] Oct 31, 2023

const props = defineProps<{
status: mastodon.v1.Status
feedName?: string
Copy link
Author

Choose a reason for hiding this comment

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

optional prop bc used by StatusCard and StatusDetail


const props = defineProps<{
status: mastodon.v1.Status
details?: boolean
command?: boolean
feedName?: string
Copy link
Author

Choose a reason for hiding this comment

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

optional prop bc used by StatusCard and StatusDetail

@@ -23,14 +26,36 @@ const {
toggleReblog,
} = $(useStatusActions(props))

function recordEngagement(engagementAction: String) {
const analyticsId = feedName ? `${feedName}.post.${engagementAction}` : `post.${engagementAction}`
Copy link
Author

Choose a reason for hiding this comment

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

Kinda messy ternary. I am open to suggestions here.

@wtfluckey
Copy link

I think we are missing a scope for when the user is taking actions on an individual's feed. I haven't tested everything yet, but I ran into a couple things:

  1. Seeing that warning feedName is expecting undefined, got Undefined when navigating to an individual's feed
  2. Also seeing that if you reply to a post from an individual's feed, we get a post.reply engagement event, but it's missing the engagement_type (screenshot below)
Screenshot 2023-11-07 at 12 19 17 PM

Comment on lines 45 to 48
function reblog() {
recordEngagement('reblog')
toggleReblog()
}
Copy link

@wtfluckey wtfluckey Nov 7, 2023

Choose a reason for hiding this comment

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

Do you know if data/product wants to have events for undoing a reblog, favorite or bookmark? Since these functions are toggles, if you un-reblog/favorite/bookmark something it just sends the same engagement event and I'm curious if anyone has mentioned wanting to have the false toggle cases tracked too

Copy link
Author

Choose a reason for hiding this comment

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

Me and Aly talked to Kirill. We are going to use separate ui_identifiers and for the "undo" actions, the engagement_type will be general

@jpezninjo
Copy link
Author

Pushed up making feedName optional + adding a feed name to the accounts feed to solve Aly's comment about events on an individual's feed

Copy link

@wtfluckey wtfluckey left a comment

Choose a reason for hiding this comment

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

great work on this!

@jpezninjo jpezninjo merged commit 9f4385a into main Nov 8, 2023
3 checks passed
@jpezninjo jpezninjo deleted the fix/posts-buttons-engagement-events branch November 8, 2023 16:45
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.

3 participants