Skip to content

onclick-hook broken -- switch to jQuery watchers instead #6

@DivineDominion

Description

@DivineDominion

The example says it's onclick="flowsplitreward", but the only JavaScript method available is called flowsplit_reward(...).

Even when using flowsplit_reward(...), the Ajax call doesn't seem to be made when the link href attribute is not "#". So every real-world link click won't be tracked.

In my tests only presentations are tracked, which sadly makes the plugin half-useless to me.


I suggest the following:

  • use data-flowsplit="reward" or something similar on the links instead of specifying the onclick attribute
  • provide a jQuery spy on $('a[data-flowsplit="reward"]').on('click', ...) which will ...
    • event.preventDefault() to stop leaving the page
    • fire the Ajax call
    • visit the original link target in the Ajax callback functions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions