javascriptsql-serveriframegoogle-chrome-extensionvote

How can I collect survey responses through a Chrome Extension?


I want to make a browser plugin that works as follows:

  1. The user enables the plugin. He then has a thumbs up and a thumbs down appear on the screen somewhere. If he clicks thumbs up, it means he likes the current web page he is viewing. If he clicks thumbs down, it means he doesn't — similar to how you vote on YouTube videos
  2. The responses will be collected from many users to a website I setup
  3. The plugin will allow people to see how many people voted a thumbs up and thumbs down for the current page they are viewing

Does anyone know how I am supposed to collect, aggregate, and return the values of the responses? Also, I would need to be able to know the ID of each user because I want to be able to perform future operations based on a user's past behavior. Can I avoid planting a cookie, in case they delete them, and have an ID that is stored in the extension's local files?

I'm sorry if this wasn't clear or if I should unpack it a bit more. I'm familiar with Wordpress, so a solution with that would be great.


Solution

  • From your requirements what i understand is For uniquely identifying a user, you can assign a Unique ID to a user who installs your Extension. For details look this answer https://stackoverflow.com/a/23854032/6428485

    1. You can use content script to add Thumbs Up, and Thumbs Down icons in website. When user clicks thumbs up/down you can use background script of extension to send vote, UserID, and website URL through POST Request to your server to store.

    2. You can collect votes from any user by above method and store it on your server.

    3. Next time when any user visits that URL you can make a GET Request to your server and get number of likes and dislikes against that URL and display them on website using content script.

    Hope this helps. Let me know if you need any clarification.