Skip to content

Instantly share code, notes, and snippets.

Last active March 25, 2020 13:58
What would you like to do?
Javascript to inject clickable link to upload Zwift activities to Cycling Analytics.
VERSION 2 : run this bookmarklet per activity.
Blog post here:
General instructions for bookmarklets and CA here:
Though somethings not working with the generated code, so go here to actually create the bookmarklet code:
(remember to replace REPLACE_THIS_WITH_TOKEN with your token)
Go to your Zwift feed:
Select the activity you want to upload, then click on the Setting/Detail icon (round gear to the right of the ride title)
Now, run that bookmarklet. A 'SEND TO CA' button should appear. Click and upload.
version history:
24-03-2020: initial version.
25-03-2020: fixed 'SEND TO CA' button css, to make it look like the other buttons.
// ----- USE EVERYTHING BELOW THIS LINE (not including this line) -----
$('.send-to-ca').remove(); // remove previous collateral
download_anchor = $("#activityFitFile"); // this is the S3 url to the activity fitfile
if (download_anchor) {
ca_title = "Zwift: " + $("#activityTitle").val();
ca_json = {url: download_anchor.attr('href'),title: ca_title};
ca_btn = $('<div class="ml-3 button border__radius__responsive--small button--bordered send-to-ca">SEND TO CA</div>').click(function() {
{method: 'POST', headers: {'Authorization': 'Bearer REPLACE_THIS_WITH_TOKEN', 'Content-Type': 'application/json'},
body: JSON.stringify(ca_json)}).then(function() {
ca_btn.html($('<i class="fa fa-check"></i>'));
}).catch(function() {
ca_btn.html($('<i class="fa fa-times"></i>'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment