Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Announcements: Tracking or stats of announcements #2423

Open
2 tasks done
skeletonz28 opened this issue Dec 30, 2024 · 2 comments
Open
2 tasks done

🚀 Announcements: Tracking or stats of announcements #2423

skeletonz28 opened this issue Dec 30, 2024 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@skeletonz28
Copy link

Plugin Name

announcements

🔖 Feature description

Possibility of being able to view how many times the announcement was viewed
If possible, able to see a percentage of active users who haven't/have read the announcement, as it is easy to click the X to close the banner vs clicking on the announcement to view the details

🎤 Context

Originally posted here: procore-oss/backstage-plugin-announcements#418 (has a possible solution commented as well)

We have started using this feature to broadcast when we have released updates and when we will be in maintenance mode. We would like to see if the news is being viewed as we now have a way of stating to the user that we have communicated this on the platform alongside our other forms of communications
Good stat to keep track of how valuable the data is being presented to the user. Able to point out how news is received within the deployed environment
Able to keep track of how often announcements are read, leading to users being kept aware of changes/releases within the environment

✌️ Possible Implementation

If using a database, maybe adding a view count table or column for each announcement.
If able to, similar to how Backstage Insights keeps track of how often a template was run, could use a similar method to keep track
Unsure if this would result in duplicate views if 1 users repeatedly views 1 announcement

👀 Have you spent some time to check if this feature request has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

No, I don't have time to work on this right now

@skeletonz28 skeletonz28 added the enhancement New feature or request label Dec 30, 2024
@vinzscam
Copy link
Member

cc @kurtaking

@kurtaking
Copy link
Member

possible backend implementation

Could we...

Add a new announcements_views table where we keep track of the announcement_id, user_id, and timestamp of when the view occurred?

knex.schema.createTable('announcement_views', table => {
  table.string('announcement_id').notNullable();
  table.string('user_id').notNullable();
  table.timestamp('viewed_at').notNullable();
    
  table.foreign('announcement_id').references('announcements.id').onDelete('CASCADE');
  table.unique(['announcement_id', 'user_id']);
  table.index(['announcement_id']);
})

Add a new recordView function to the AnnouncementsStore

await this.db(viewsTable).insert({
  announcement_id: announcementId,
  user_id: userId,
  viewed_at: DateTime.now().toSQL(),
});

Add a new post route -> /announcements/:id/views

const announcement = await persistenceContext.announcementsStore.announcementByID(
  req.params.id,
);
 
if (!announcement) {
  return res.status(404).end();
}

await persistenceContext.announcementsStore.recordView(req.params.id, userId); 

Then some effect that runs a hook on the frontend to hit the route.

@vinzscam vinzscam added the help wanted Extra attention is needed label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants