Download tracker plugin

Does anyone know of a plugin or mod that will keep track of which user clicked a link or downloaded an attached file?

1 Like

i suspect you probably need to use google tag manager for this. Discourse itself doesn’t track individual user’s clicks (it tracks topic views and link click counts by users as a whole) and i haven’t seen a plugin that does this sort of tracking at the individual user level.

2 Likes

TY. Was hoping someone had created something like this that works with the latest Discourse…

Don’t really need the restrictions, just the logging of who downloaded what.

If you have a budget you can post in marketplace or contact me. I have no idea what it would take without looking at the code. Links get tracked, so it should be possible to also log who clicked them. Downloads will likely be harder.

1 Like

FWIW There’s the topic_link_clicks table with a bit more info in, though I think it has the limitation of only counting direct clicks and not eg. ‘right click and open’.

4 Likes

oh i didn’t think it tracked the user info but i see now there is a user_id field in the table :+1: interesting :face_with_monocle:

4 Likes

Oh!
Could someone kind person with more SQL chops than me create a query that would list the post, link and username?
(I have the DataExplorer Plugin for running queries)

3 Likes

Something like this should do it:

-- [params]
-- int :topic
-- int :post_number

SELECT 
    tl.post_id,
    tl.url,
    tlc.user_id
FROM topic_link_clicks tlc
  JOIN topic_links tl ON tl.id = tlc.topic_link_id
  JOIN posts p ON p.id = tl.post_id
WHERE p.topic_id = :topic 
  AND p.post_number = :post_number
  AND tlc.user_id IS NOT NULL
ORDER BY tlc.id

You can use the topic id and post number from the address bar to pull up all the users who clicked on the links in a specific post (you may need to refresh the page once you paste it in to get the parameter input boxes to show up the first time).

Hopefully that helps. :slight_smile:

7 Likes

TY. Works fine!
Seems to me that a plugin that would show who clicked any link in a post would be quite easy to make (for someone that knows how to make plugins)
Ideally, hovering over the number would pop-up the list of who clicked, with a little “copy” icon in the corner! :slight_smile:

2 Likes

this sounds similar to some of the like/reaction button functionality

1 Like

That’s possible, you’d need to add that list to the topic serializer.

1 Like

Anyone feel like having a crack at it?

you may want to post this in marketplace to get some interest for developers

3 Likes