Overwatch [Guide] How to track your daily SR changes for each role automatically By: HydrationAdvocate

0
9

With the new season here I wanted to share something I have been doing for the past several months to track my trends on the ladder over time. All you need is a Google account and a public profile.

  1. Create a Google Sheet, I called mine OW Analytics, and freeze the top row with the following columns: Date, Rating, Tank, Damage, Support. Name the sheet Daily SR Tracker

  2. Click on the Tools menu and open the Script Editor.

  3. Paste the following into your script, substituting your battle.net id#number. Note you need to match capitalization and use a - instead of a # for your numeric portion:

/* This script is scheduled to run between 5 and 6am every day */

// https://www.quora.com/How-do-you-automatically-pull-data-from-the-API-into-Google-Sheets
const bnet = "BNET-NUMBER"
const owAPIURL = `https://ow-api.com/v1/stats/pc/us/${bnet}/profile`

function getProfileStats() {
  var response = UrlFetchApp.fetch(owAPIURL, {
    'Content-Type': 'application/json'
  })
  return JSON.parse(response)
}

// https://stackoverflow.com/questions/42449852/how-to-insert-data-into-a-specific-row-number-or-the-first-empty-row
function setDataToTable() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Daily SR Tracker")
  var stats = getProfileStats()
  var {rating} = stats
  var tank = stats.ratings.find(e => e.role === "tank")
  var dmg = stats.ratings.find(e => e.role === "damage")
  var sup = stats.ratings.find(e => e.role === "support")
  //sheet.appendRow([
  sheet.insertRowBefore(2)  // do before because after copies the bold styling from headers
  sheet.getRange(2, 1, 1, 5)
   .setValues([[
    new Date(),
    rating,
    tank.level,
    dmg.level,
    sup.level,
  ]])
}

4. In the script editor, click the Triggers icon (clock / speech bubble icon next to the save button) and add a trigger. You may have to permit App Scripts access to your Sheet (can’t remember as I set this up a while ago). Run the setDataToTable function as a Time Driven event source with a Day Timer. I selected between 5am and 6am local time for mine to run since I know I will (almost) never be playing at that time. Do not forget to click save

5. You should be done! Now you can modify the script / spreadsheet as you see fit. I added a second sheet to graph my trends over time (below), and I also will clear the main sheet every season and store a copy to show isolated season data.

r/Competitiveoverwatch - [Guide] How to track your daily SR changes for each role automatically

Daily ratings across season 23

Leave a Reply