Support » Plugin: WP-Ad-Manager » [Plugin: WP-Ad-Manager] Use javascript to count clicks

  • I was wondering if it has been considered to use javascript in order to track the clicks rather than the current redirect. I know if I hover over a link and it isn’t going directly to the site I want I wonder what that is all about and sometimes even type in the address instead.

    What could be done is that if javascript is not enabled the current redirect system would occur. If javascript is enabled the link address is direct to the site but an onclick would register the click and then send the user to the site.

    I was looking at the code tonight to see if this could be done but since the link code is processed through the editor rather than a textfield you don’t know exactly what sort of html you are dealing with.

    If the creation form was changed so that you

    • Uploaded an image
    • Enter the link to go to

    Then the display code could generate the correct link based on whether javascript is enabled or not. Interested in your thoughts on this.

    Also happy to help with this if this is considered worthwhile, or with anything else code related I can help with. I rely on this plugin so I’m happy to help make it the best it can be.


Viewing 2 replies - 1 through 2 (of 2 total)
  • Refined the idea on the way home from the shops today.

    Rather than change the interface, just check for any ad widgets in the page and insert the onclick and change the a href using javscript. Therefore if javascript is disabled, the original functionality works. If javascript is enabled, then the new functionality works.

    I might look at this further on my site and submit a patch if I get it working nicely.

    Plugin Author valentinas


    Help is very much appreciated. I’ve sent you email about the code that you were implementing, if you could fix that, that would be very cool.

    As for javascript to track clicks there is one major issue:
    An ad can be:
    – A picture
    – Text
    – Javascript (from some ad-serving network)
    – Iframe
    – Flash
    – Etc…

    So there is no way to know to which element we should bind an action.
    As for the links with redirects, i don’t think that’s an issue. This is common practice. Google, facebook, everybody uses it.

    Clicks is tricky part, so lets leave it for now. If you’re keen you could play with impressions. Some people say that those does not really work well. Also we need to ignore robots (i had robots list somewhere, i could email it to you if you want to play with it).

    Thanks again for contributing, i really appreciate that 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WP-Ad-Manager] Use javascript to count clicks’ is closed to new replies.