Graphing My Cycling Progress on Strava and Automating With Zapier

Since I moved to a new home that’s closer to work, I’ve been riding my bike to commute at least a few times each week. My commute to work is very easy as it’s almost completely downhill. I pay for it on the way back, though. I’ve been trying to get healthier, so commuting with my bike has definitely become a priority. In addition to having fun, I’d also like to motivate myself to ride more often and push myself to get better at it (especially the uphill part).

I’ve been using Strava to track my rides, and it turns out that my ride home includes a user-generated segment that automatically tracks my performance when I’m going uphill on Liberty. The first time I rode, it took 10:44 for me to complete. My best time so far is 6:58. The cool part is that I’m able to see the progress I’ve made, and I really do feel accomplished when I beat one of my best times. Here’s the view I’m using to see what my times are:

Stava SegmentThis isn’t the easiest table to read, but you can see that the dates sort of correlate with my times, as the fastest one is in September and the ones in August are slower on average. While beating my fastest time is a good motivator, it’s not realistic to try and break my record every time I ride. I’d rather see consistent improvement as a motivator.

To visualize this, I decided to grab all of the times by viewing the full leaderboard (with just my results). I gathered the times and dates and thew them into a Google spreadsheet to visualize my trend. Here are the results so far.

Strava Trend

Success! It looks like I made some really good progress since I started in July, and my times have been inching downward as I get better at cycling uphill. The times also probably vary a bit because there are some stop signs and a traffic signal within the segment, which can slow me down.

The next problem I wanted to tackle was the data entry bit. Since it’s a pain to update the spreadsheet each time I ride,  I wanted to automate the addition of new efforts (the term that Strava uses to describe single instances of activities on a segment). This is where things get interesting.

Because I’m storing the efforts in a Google Doc, and because Strava has an API, I just need to connect the two together. Unfortunately, my go-to choice for this kind of thing, IFTTT, doesn’t have Strava as a channel. Luckily, I can do something similar with Zapier (btw that’s a referral link, so be sure to click it so I can get more tasks), which is sort of like IFTTT but costs money (albeit with a nice free tier) and has more integrations. You can also set up your own integration, which is what I had to do with Strava.

In order to get the list of my efforts on that particular segment, I had to create a few Zapier “triggers.” One to get my Strava user ID (for use in other API endpoints), another to grab my starred segments (so I could specify which segment I wanted to track), and finally a trigger to listen for any new efforts on my commute’s segment (limited to efforts created by me). I also had to post-process the last trigger so that I could get the date in a format that works in Google Spreadsheets. The result looks something like this:

Strava Zapier

Now, whenever I ride home on my bike while recording the segment with Strava, the effort will be automatically logged and graphed on my Google Spreadsheet! Apparently, I can embed the chart, so here it is!


Chart

While the Zapier integration had a somewhat steep learning curve, it’s nice to just set the “zap” and then forget about it. Any new integrations I might need to write will also go much quicker. As always, Runscope was a really useful tool for exploring the Strava API and getting real responses from the API to play around with. Finally, I learned the right way to spell athlete rather painfully (after misspelling athlete_id a billion times and wondering why my request wasn’t filtering correctly)!

I went from seeing some sketchy looking progress in my Strava results table to being able to visualize it on a graph, while also setting the graph up to update whenever I record a new effort! Automation for the win!

If you’re interested in the details of the integration, or if you want to try it out yourself, let me know and I can invite you as a tester. If there’s a lot of interest, I can also go over the creation of the integration, as I ran into a few gotchas while building it.

10 thoughts on “Graphing My Cycling Progress on Strava and Automating With Zapier

  1. Very nice integration! I’m looking for a way to automatically share my Strava activities to Twitter, either directly or through Zapier. I already tried to do it via Facebook, through Zapier, and confirmed with Zapier that it wouldn’t work that way. Do you think something like this is possible?

    1. Hi Chris, thanks for the comment! This is definitely possible using the Zapier integration I’ve written. I made a “beta” version of the integration if you’re interested in trying it out. Just go to this link:

      https://zapier.com/developer/invite/13496/a8dfb674e69310a871f44a10fe08202d/

      You can use the trigger for a new ride, and pair it up with a new tweet. The output should look something like this:

      Let me know if you have any questions about getting it to work.

      1. Thanks! The trigger works, however the output’s not looking great. It looks like just text, see this Tweet for an example – https://twitter.com/cjremus/status/524681563091775489

        Ideally, I’d like the output to look like the Tweet that is sent when you hit the Twitter share button on a workout in Strava. Alternatively, I’d like to at least add how many miles the ride was and maybe the image link. Do you think it’s possible to do any of this?

        1. Hey Chris, it looks like you figured out the formatting for the Strava integration based on your more recent tweets. Let me know if that’s the case or if you need more help with it.

    1. Sorry, after thinking it through as what I want to do is give friends kudos there would have to be a trigger to do so and I can only see List activity kudoers, and it doesn’t seem to be a part of Update activity.

  2. This is a very interesting article!
    Hung, just to let you know, there are recipes for Strava available on IFTTT by now.
    Unfortunately the data is rather basic with the only metrics being distance and time.

Leave a Reply