WordPress.org

Ready to get started?Download WordPress

Forums

WP SlimStat
[resolved] Tracking right click of download links (5 posts)

  1. SpenceDesign
    Member
    Posted 2 years ago #

    Hello again Camu,

    I thought I would start a new thread on this topic to better facilitate separation of it from the open in new window thread.

    Here is what I have discovered when trying to track right clicks of file downloads in SlimStat. Currently my downloads are set NOT to open in a new window due to the problems associated with that.

    Using this code, left click is tracked as "2" and right click is tracked as "3" in event files.
    <a href="/files/download.pdf" onclick="ss_te(event,2)" onmousedown="if((event.which == 3) || (event.button==2)){ss_te(event,3,false);}">Download file</a>

    This works fine except for when the right click is tracked, the file path is NOT tracked, only the page that the link was on.

    Example of what appears in "Recent Events" on the Content page when the file link is right-clicked: /page_with_link/

    Example of what appears in "Recent Events" on the Content page when the file link is left-clicked: /files/download.pdf

    Rather than assigning each link a different number and creating a file (cheat sheet) to match link numbers with the associated files that were downloaded, I am wondered if you had any thoughts on why the link path was not getting logged using the right-click option?

    Important to note that the above "right-click" tracking code does not function properly when using "onmouseup" or "oncontextmenu", only "onmousedown" works almost right except for not tracking the full file path.

    Also note the resulting outcomes to the tests using these variations.
    1. When replacing ss_te(event,3,false) with ss_te(event,3,true) on right-click the file automatically starts to download before an option is chosen from the right-click menu and the auto download is tracked but not any resulting choice from the right-click menu.
    2. When replacing ss_te(event,3,false) with ss_te(event,3) on right-click the file DOES NOT automatically start to download before a option is chosen from the right-click menu, which is good, but the download is NOT tracked either.

    Hoping you have some ideas on this topic.

    Regards,
    SDesign

    http://wordpress.org/extend/plugins/wp-slimstat/

  2. camu
    Member
    Plugin Author

    Posted 2 years ago #

    I have some good news and some "bad" news for you. The good news is that I'm almost done rewriting the Javascript that takes care of tracking events.

    The bad news is that what you described was sort of the expected behavior. In other words, when you right-click a link, I was assuming people would be interested in knowing WHERE the event took place, since a right click is not telling the browser to load a new page/document, "per se". At least this is what I want to know.

    What I can do is to add two new columns to the table where the information about those events is stored:

    - resource (page where the event took place)
    - notes (in case you want to add some extra custom information to the event)

    Why is that a bad news? Because I'm also planning to implement a new upgrade procedure that detects changes to the DB structure and upgrades the tables if needed, without the need to deactivate/activate WP SlimStat anymore (a lot of people forget about that step and then complain that the plugin is not working eheh).

    So updating the DB structure depends on implementing the new functionality. It shouldn't take too long, though.

    Thank you,
    Camu

  3. camu
    Member
    Plugin Author

    Posted 2 years ago #

    Looks like it took less than I thought to implement the new functionality. Would you be interested in previewing and testing version 2.8? If so contact me at

    http://www.duechiacchiere.it/contatto

    and I'll send you the new files along with some instructions on how to use it :)

    Cheers,
    Camu

  4. SpenceDesign
    Member
    Posted 2 years ago #

    Thanks Camu, I appreciate your efforts on this. I will look for the files from you early next week.

    Regards,
    SDesign

  5. camu
    Member
    Plugin Author

    Posted 2 years ago #

    Great, thank you. I'm currently running some tests on my blog to see if things work as expected in a production environment. Just so you know, version 2.8 is now also recording WHICH link has been clicked, either using its ID (if available) or a sequence number (where 1 is the first link on the page, 2 the second, etc) :)

    This is actually the first step towards version 3.0 which in my plans should implement a google-like js-bases tracking system, which will make WpSlimStat compatible with every cachin plugin available out there.

    Cheers,
    Camu

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic