Skip to content

Instantly share code, notes, and snippets.

@arafathusayn
Created January 14, 2019 12:36
Show Gist options
  • Save arafathusayn/080227c983273afe0c443ec1fc4c7346 to your computer and use it in GitHub Desktop.
Save arafathusayn/080227c983273afe0c443ec1fc4c7346 to your computer and use it in GitHub Desktop.
From Google Play Console, this script will get the name list of the active device models and the number of installs for each in JSON format in clipboard
/*
* Instructions:
* Go to "Google Play Console" > "Statistics" > click on the dropdown beside "Select" and choose "Device" ...
* Then click "Add Device" and you can read the list of active devices and the number of installs ...
* After that, run the script in the browser console and you'll see a table after a while and the JSON data will be copied.
*/
const spans = document.querySelectorAll('[aria-label*="device :"]')
const data = []
let skipFirstOne = true
for (const span of spans) {
if (skipFirstOne) {
skipFirstOne = false
continue
}
const tr = span.closest('tr')
const trText = tr.innerText.trim()
const trTextArray = trText.split("\n")
const name = trTextArray[0]
const installs = parseInt(trTextArray[1])
data.push({ name, installs })
}
console.table(data)
copy(data) // Browser console specific
@arafathusayn
Copy link
Author

Hints in Screenshot:

finding active device names and installs screenshot_1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment