Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

API call for user count in Chrome Web Store? [closed]

I have an extension in the Chrome Web Store and I like knowing roughly how many people are using it via the "N users" and ratings on its page.

However, I don't really like loading the whole "product" page just to see a couple of numbers and thought I'd try to make a little widget that would display it instead. However, I can't find any API documentation for the Chrome Web Store.

I would a call like /webstore/api/v1/appid.json to exist, but the closest things I've found in searching only concern the Licensing API.

Is there an official Chrome Web Store API for user metrics?

like image 995
Benjamin Oakes Avatar asked Aug 10 '11 01:08

Benjamin Oakes


People also ask

How do I inspect an API call in Chrome?

With Chrome Dev Tools, you can see which set of API endpoints your app is calling when you perform some action (say when you click a button), and so you'll understand you app's behaviours better. Anyway, head over to https://dev.to, right click on any area, and click the Inspect tab.

Is Chrome Web Store closing?

The blog below says the Chrome Web Store will be supported until June 2022.

How do I track my Chrome usage?

You can view the breakdown of the data in the Stats tab. Webtime Tracker shows detailed information of time spent on each website. These details include the time spent today, total time spent, average time, least and most active days, etc. By default, the idle time is 30 seconds, but you can adjust it.

Is there an API for Chrome?

The Chrome Management API is a suite of services that allows administrators to programmatically view, manage, and get insights about policies and usage of ChromeOS devices and Chrome browsers in their organization.


3 Answers

This is no such API.

You can use Google Analytics inside an extension to track users manually.

If you don't need anything fancy, just a number of installs and users, there is My Extensions extension, it will track those numbers for you.

like image 178
serg Avatar answered Nov 03 '22 10:11

serg


Copy and paste the snippet below wherever you want in the body of a html document saved with a ".php" extension.

<?php

//URL of your extension
$url = "https://chrome.google.com/webstore/detail/ddldimidiliclngjipajmjjiakhbcohn";

//Get the nb of users
$file_string = file_get_contents($url);
preg_match('#>([0-9,]*) users</#i', $file_string, $users);
$nbusers = str_replace(",", "",$users[1]);

echo $nbusers; //Display the number of users

?>
like image 33
flo Avatar answered Nov 03 '22 09:11

flo


You can also do this client-side only (at least on your end) by using a cross-domain tool. This snippet will grab the number of users displayed on the Chrome webstore page for an extension (up-to-date as of April 28, 2018):

var chromeExtensionWebstoreURL = 'https://chrome.google.com/webstore/detail/background-image-for-goog/ehohalpjnnlcmckljdflafjjahdgjpmh';

$.getJSON('http://www.whateverorigin.org/get?url=' + encodeURIComponent(chromeExtensionWebstoreURL) + '&callback=?', function(response){
    var numUsers = ((""+response.contents.match(/<span class="e-f-ih" title="([\d]*?) users">([\d]*?) users<\/span>/)).split(",")[2]);
    console.log(numUsers);
});

In the future, Google may change the class name of the user count span, in which case you just need to update the regex appropriately.

like image 31
David Avatar answered Nov 03 '22 08:11

David