Title: [Plugin: WP-Ad-Manager] Use javascript to count clicks
Last modified: August 19, 2016

---

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

 *  [NicholasPerkins](https://wordpress.org/support/users/nicholasperkins/)
 * (@nicholasperkins)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/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.
 * Cheers,
    Nick
 * [http://wordpress.org/extend/plugins/wp-ad-manager/](http://wordpress.org/extend/plugins/wp-ad-manager/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [NicholasPerkins](https://wordpress.org/support/users/nicholasperkins/)
 * (@nicholasperkins)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-wp-ad-manager-use-javascript-to-count-clicks/#post-1889911)
 * 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](https://wordpress.org/support/users/valentinas/)
 * (@valentinas)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-wp-ad-manager-use-javascript-to-count-clicks/#post-1889912)
 * 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.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-ad-manager.svg)
 * [WP-Ad-Manager](https://wordpress.org/plugins/wp-ad-manager/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-ad-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-ad-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-ad-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-ad-manager/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [valentinas](https://wordpress.org/support/users/valentinas/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-wp-ad-manager-use-javascript-to-count-clicks/#post-1889912)
 * Status: not resolved