Data Migration from to

A few years ago, I used the app for activity logging. After switching to Strava, I wanted to move my activity data to the new platform. Sports-Tracker allows exporting of activities, but only one-by-one. This is rather tedious with a few hundred activities.

Then I came across a small script that will create batch download commands for each activity when run in Chrome. The original script can be found here, but I had to do a few slight modifications to make it work again.

// based entirely on this blog post:
// unfortunately the original script no longer works, moslty because jQuery is 
// no longer available on sports-tracker pages.

var key = "sessionkey=";
var valueStartIndex = document.cookie.indexOf(key) + key.length;
var token = document.cookie.substring(valueStartIndex, document.cookie.indexOf(';', valueStartIndex));
function downloadOne(item) {
    var href = item.href;
    var id = href.substr(href.lastIndexOf('/') + 1, 24);
    var url = '' + id + '?token=' + token;
    var filename = 'SportsTracker-' + id + '.fit';
    console.log('curl -o ' + filename + ' "' + url + '";sleep 2');
function loopThroughItems(items)
    var i = 0;
    for (i = 0; i < items.length; i++) {
var items = document.querySelectorAll("ul.diary-list__workouts li a");
document.body.innerHtml = '';

To run the script, you have to do the following:
1) Login to your sports-tracker account using Google Chrome
2) Change URL to
3) Open browser console (Ctrl-Shift-I)
4) Paste the script, hit enter – it’ll run and print something like this to the cosole:
curl -o SportsTracker-<>.fit „…..“
5) Right-click on the colsole and save the contents to a file – call it something like „“
6) Edit the file: remove the javascript at the beginning of the file leaving only curl commands
6) Open (Linux bash) terminal (MinGW would be an option if you are using Windows)
7) Change to the directory where you saved the contents of the console
8) Fix permissions using chmod +x
9) Run the script: ./

Alternatively, you could download GPX files instead of FIT files. Just replace all occurences of fit with gpx in the JavaScript.

Some files will be downloaded with zero length. Just put the corresponding curl statements in another script and run it again until all files have been downloaded correctly.

Data migration from Sport Tracks (Windows application) to Strava

The Sport Tracks windows application allows exporting all activity data in GPX format. You can select the activities to be exported in activity view and then select export and GPX from the menu bar on the left.

Unfortunately, all activties will be exported into a single GPX file. Strava on the other hand needs a single activity per file to be able to import GPX data.

For this reason, I’ve written a small bash script that can split the single export file from Sport Tracks into many files containing just one activity for importing in Strava.

Here is the script:

head -3 "$input" >/tmp/header
mkdir -p files 2>/dev/null
cd files
rm -f xx[0-9][0-9[0-9][0-9] [0-9].gpx
csplit -n 4 "../$input" '/^ /' '{}'
for f in $(echo xx*)
     [[ $f == xx0000 ]] && continue
     echo "Creating $newf from $f"
     cp xx0000 $newf
     cat $f >>$newf
     echo "" >>$newf
     rm -f $f

In order to run it, you need to replace the value of the input variable by the filename of your Sport Tracks. The script runs under any flavour of Linux (I used Ubuntu 16.04), probably (I didn’t test it) under Windows Subsystem for Linux as well.

The result will be a directory called „files“ containing a separate GPX file for each activity contained in the Sport Tracks export that can be imported to Strava (up to 25 files at a time) through their web interface right away.