Question

I want to detect if a user has drag and drop the bookmarklet I created to the bookmark menu. Is there any way to do this?

Was it helpful?

Solution

To know with absolute certainty that they have simply installed a bookmarklet is not possible under normal circumstances.

To know with near absolutely certainty that they have installed AND USED a bookmarklet is possible. For example if your bookmarklet calls or navigates to a URL, you can add a parameter like &origin=bookmarklet to the URL and track that on the server.

You could also get a pretty fair idea that a person at least tried to install the bookmarklet by using the drag event on the bookmarklet link. Something like

<a ondrag="recordBookmarkletDragEventOnServerWithAjax()"
  href="javascript:/* bookamrklet code */">myBookmarklet</a>

You could embed a unique ID number in each bookmarklet enhance your tracking installation tracking. For example:

<a ondrag="recordBookmarkletDragEventOnServerWithAjax('9h297gh3sdsd')"
  href="javascript:id='9h297gh3sdsd'; /* bookmarklet code sends id to server */"
  >myBookmarklet</a>

Using an ID number like above, it might be interesting to see how many people drag your bookmarklet but never use it.

Alternatively you could have them install an addon or extension which would could automatically make a call to your sever confirming installation.

OTHER TIPS

No; you can't.

However, you can make it log clicks to your server. (or to JS code on the page you click it on)

No. A webpage is not allowed to access the user's bookmarks for security/privacy reasons (and there is no API that would allow it even with explicit permission). Only a browser extension might be able to do so (for FF there is the Bookmarks API then). Notice that bookmarklets are not "installed", they are just javascript snippets stored as bookmarks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top