Track chrome extension's reviews - javascript

I want to give a reward to the users of my chrome extension when they rate the extension on the Chrome Store. Do you know how I can monitor this event (user rating the extension)?
I am thinking of 2 ways to do so:
If I can monitor the event directly from the chrome extension, I would just put a button which will redirect to the Chrome Store, and will monitor when the user rates the extension.
If I cannot monitor the event, I can also put a button, which will redirect to a page, from where a popup will be opened with the chrome store (and maybe I can track the rating in the popup from the main page?)
The first approach is obviously the one which is the most interesting to me, and the second would only be an alternative if there is no way to use the first one.
Thank you!

There are no events associated with Webstore ratings/reviews that are part of Extension (or Webstore) APIs.
In fact, you can't track what the user does in Web Store at all, since you cannot inject a content script there - it's a special case in Chrome code. Reasons for that are pretty obvious - a content script in the Store could do automated ratings/reviews.
So the most you can do is rewarding a user clicking a link to Webstore somewhere in the extension (say, "Please rate the extension [here]"). You'll have to believe that the click is done at least with the intent to rate.
Extra consideration: some unscrupulous app developers would show the following UI to the user:
How would you rate our McGuffin?
[I would rate it 5 stars!] (link goes to Store rating page)
[I would rate it 1..4 stars] (link goes to developer's feedback form)
This obviously screws up the rating and should be considered unethical. Please avoid that - any honest rating should be equally precious.

Related

Webpage input element, not URL / Open Site Dialog

I am working on an application that asks individuals to paste links to their social media and other relevant sites as part of the setup process. These later get turned into links on a compiled HTML page.
We are seeing a user issue that is arduous to deal with. When setting up the account on mobile, individuals do not understand that they need the website link to these various places, they try and open the target sites app instead (Facebook as an example), or they stare blankly unsure of what to put in the box or how to proceed.
I'm looking for a solution to this conundrum to help people achieve their ultimate end goal of putting the link on the resultant page.
I tried an iframe approach, whereby the thought was to load the target site, allow the user to navigate to the desired page, and hit a done button. Obviously this approach ran into several road blocks due to security restrictions and frame busting implemented by the various sites.
What would be great would be something like the file input, but for websites instead. We have the "URL" input; however, that only checks the URL for validity, I'm more interested in an approach that would open something akin to the file dialog, that would allow a user to navigate to a site and hit "done"
I've not been able to find anything that comes close. I'm seeing if someone knows something I do not, or has an idea I haven't yet tried. Ultimately, I'm trying to make it easy for an average consumer to choose the target for a link. (I'm fully aware how easy it is to open a browser tab and copy the link, I am truly supporting consumers who find that somewhat difficult / confusing)
Thank you for your time and consideration

Chrome Notification API (for Extensions!) How to Re-enable Once Blocked?

I have spent considerable time researching this and hopefully I have just missed something so I thought I would bounce it off the StackExchange community as well.
Background:
On latest Chrome > 65, all of the notifications are stores on a per-site basis, so if one were to grant or deny notification popup for a SITE and want to reverse that decision (accidentally clicked the "block" for example) they can simply go into Chrome notification settings, find that specific site, and remove the block. This works as designed today and is well documented.
So here is the issue detail in a scenario:
Now, that exact same mechanism is used for extensions. An extension is initially granted all it's required permissions and works properly. Then, the user accidentally clicks "block" one time on a single desktop notification from the extension using the "gears" cog-wheel icon on the notification which then changes the notify balloon to this prompt:
Now, any time that extension attempts to send a notify message, instead of the normal desktop notify, an ugly javascript notify pops up in the middle of the screen (with the exact same notify text), and two buttons - "OK" and "Cancel". All extension functionality is unchanged if "OK" is clicked for example, the very same functions fire as if the user had clicked the prior desktop notify balloon popup.
Here are two screenshots of this exact scenario using the popular Tampermonkey Chrome extension (using a randomly selected script with a known update) that uses desktop notification API to communicate script updates:
"Normal" desktop notify message with default grant permission:
The exact same message (appears in center of the screen) once that permission is revoked by user clicking "block". **Note the actual message itself is not blocked which I find odd, just the desktop notify GUI bubble:
So, the question is really 2-fold:
Where does Chrome store that boolean value of PermissionLevel FOR EXTENSIONS - as they do NOT appear in the normal list of granted/blocked SITES. If not in the UI, is this setting exposed in a configuration file or is there even currently any way in Chrome>65 for the user to ever reverse this decision?
Is there either a programmatic method that can be implemented by an extension developer on the back-end to ever check if this has occurred and re-prompt the user to change their mind and re-grant that permission? I have found a couple unofficial posts here saying common sense says no to avoid malicious harassing of users etc. but I cannot find anything official.
Well, I can confirm after opening this as an official Chromium bug, that it's sitting waiting for triage and clearly has no current workaround here:
https://bugs.chromium.org/p/chromium/issues/detail?id=825497
I also did further testing to determine you can use the ID from the extension and add it into "sites" settings which also based on that behavior, appears to be yet another bug due to some settings not saving, none having desired effect, etc.
I will post this as the current answer as of 04-09-2018:
"it is impossible to re-enable Chrome desktop notifications FOR A SPECIFIC EXTENSION once blocked".
If anyone can post here a successful workaround to in any way re-enable the normal desktop notifications for an extension (tested with Tampermonkey) after the user clicks the "block all notifications from this app" to simply reverse the decision that would be great but I think as long as this has remained unanswered makes me lean towards believing there simply is no current method and it is just a (glaring) UI bug.
Sadly the only method for reversing this is to remove the extension and re-install it.
This issue has been open for nearly half a year. Not expecting a fix any time soon at this point. https://bugs.chromium.org/p/chromium/issues/detail?id=825497
Please star this issue at the link above if you're affected by it.

Chrome auto tab discarding disable java script?

Chrome implement new feature which is called auto tab discarding through this feature enable user when user not on the tab that tab will discard and when user re click on that tab chrome auto refresh that tab. here is the link of Article. this is is very good feature But my problem is I'm showing notification when our tab is active in chrome but because of this feature our Tab is discard and not able to show notifications anymore.
My Question is :- How to Disable this feature or there is any way to keep my tab active or any way to prevent that from discarding?
Users can switch off automatic tab discarding by setting the respective flag in Chrome using this link: chrome://flags/#automatic-tab-discarding
But every page with states depending on user input do have the same problem like yours. Usually, you can prevent unloading a page with handling the onbeforeunload event in JavaScript. Unfortunately, Google does not prevent a solution for this on all systems, despite many users had problems with this feature already in the experimental phase, as you can read in the user comments:
https://developers.google.com/web/updates/2015/09/tab-discarding
For ChomeOS, the problem seams to be fixed:
https://bugs.chromium.org/p/chromium/issues/detail?id=123049
On Android, automatic tab discarding is quite aggressive and prevents using Chrome for applications with significant user input, imho.
On Windows, automatic tab discarding only starts if the available memory is low.
Sorry for not coming up with a proper solution here (I'd be really happy to have one) - I did extensive research and this is all I could find.

Removing Firefox Star Icon and Bookmark Icon

I am building an application which has requirements stating that all browser features must be disabled. (It's a test taking application and they are worried about security/cheating.)
I popup a new window so that I can make it fullscreen, disable the menu bar, tool bar etc. However Firefox still has two icons remaining that I can't figure out how to disable. The 'Page' icon and the 'Bookmark' star icon are still on even when I call window.open with location=no. Here is the window.open command:
window.open("filename", "test", "fullscreen=yes,status=no,toolbar=no,location=no,menu=no,directories=no,scrollbars=yes");
Is there anything I can do about this?
From the MDC documentation for window.open():
Mozilla and Firefox users can force new windows to always render the location bar by setting dom.disable_window_open_feature.location to true in about:config or in their user.js file
In Firefox 3, dom.disable_window_open_feature.location now defaults to true, forcing the presence of the Location Bar much like in IE7.
This was done to help thwart phishing exploits. You're better off (your users are better off) leaving it enabled, even if you have control over the machines on which the browser is running.
You should really be designing your application such that knowing or bookmarking the URL won't help would-be cheaters. For instance: don't accept an answer to a question when an answer has been previously submitted.
If you don't have control of the computer the user is taking the test on, there's nothing you can do (and opening a full screen window won't prevent cheating for savvy users, either).
If you do have control over the computer or can instruct the user to install an application, you'd be best suited by building an actual application with embedded WebKit or Gecko.

What percentage of followed hyperlinks might have their "onclick" JavaScript ignored?

As far as I know all popular web browsers execute the onclick attribute of an anchor link first, then follow the path specified by the href attribute.
The problem here is that the onclick attribute only gets called when clicking with the left mousebutton (without pressing ctrl or shift for a new tab or window) or when pressing enter on your keyboard while the tabIndex is set to the link you want to follow.
But there are many other ways of following a link than just those two.
Ctrl + click
shift + click
rightmousebutton + open
rightmousebutton + new tab
drag & drop link to address bar
and so on...
My client uses onclick for conversion statistics. Which seems heavily unreliable.
My question:
What percentage of hyperlinks are being followed without activating their onclick attribute?
All estimates are highly appreciated. I'm completely lost; I think it can be any number...
Aside from those of us who habitually middle-click/ctrl-click to open links in new tabs, there's another major cause of onClick failure: NoScript and similar plugins which allow javascript to run only when it comes from whitelisted sites. If your domain isn't on my whitelist, then your onClick won't run, no matter how I trigger the link.
If you want reliable stats on which pages people are visiting, there's only one bulletproof source for that: The web server logs.
The logs are probably also your best bet for tracking how people move throughout the site, but they're not entirely reliable, as some privacy-paranoid users will falsify their referer headers or just not send them at all, but I expect that to be far less common than disabling javascript.
It depends. If the audience is more technically inclined, I'd assume that using alternative ways of following a link would be more common. All in all, though, even a lot of technical people seem to be unaware of things like clicking the middle mouse button to open or close a tab. If that's the case with technical people, I wouldn't be surprised if almost no one in the general audience used it.
The links are all exit-links. I was thinking of a PHP script that does the counting of clicks.
Though this is not the subject of your question, you might want to have a look at Google Analytics then. They are The Master in tracking you. They track right-clicks (even when not actually selecting "open in new window" after that, which they obviously cannot know), which will yield Ajax calls to http://www.google.com/url.
To see Analytics in action: with Adblock and the like disabled, search something on google.com and open up Live HTTP Headers in Firefox (or your Firebug Net tab in Firefox, or WebKit's Resources pane in Safari or Chrome, sorted by time). Next, click, right-click, shift-click or control-click any search result (preferably a result that does not require a lot of HTTP traffic by itself, or is in your browser's cache).
the onclick attribute only gets called when clicking with the left
mousebutton (without pressing ctrl or shift for a new tab or window)
Not entirely true. I created a quick test at JS Bin, to show that modifier keys do not affect the onclick event. (For right-click, one should use the oncontextmenu event.)
What are you doing in your onclick handler that you are worried about not working? e.g. if you have a regular link to a page... and the onclick just opens that same page in a pre-sized popup for user convenience in a web application... then there's likely no issue (e.g. CTRL+Click) still opens the page, it just gets opened in a new tab)
If you are just trying to "log" every click in the site/application for tracking purposes then maybe you can hook into the onmousedown/up or focus/blur events instead/also.

Categories

Resources