- For: treasurers and whoever runs the website
- You get: a thermometer on your website that fills as donations come in, with no key in the website’s code
- Time: about fifteen minutes
- Scopes:
fundraising:read
- A Google Sheet that reads your campaigns from Scoutworks every hour.
- A small piece of HTML on your website that reads the sheet.
1. Fill a sheet with your campaigns
In a new Google Sheet, choose Extensions → Apps Script. Delete what is there, paste the script below and choose Save.Code.gs
1
Add your key
Choose Project Settings (the cog), then Script Properties → Add script property. Property:
SCOUTWORKS_API_KEY. Value: the sandbox key to try it, or your own key.2
Run it
Choose updateTotals and press Run. Open the Totals tab. Each campaign has a row, found by its
slug: the last part of the campaign’s address on your donate page.3
Refresh it every hour
Choose Triggers (the clock), then Add Trigger. Function:
updateTotals. Event source: Time-driven. Type: Hour timer. Every: hour.2. Publish the totals tab
In the sheet, choose File → Share → Publish to web. Under Link, choose the Totals tab (not Entire document) and Comma-separated values (.csv). Choose Publish and copy the address. The published tab holds only campaign totals: no donor names, no amounts of single gifts and no key. Google updates a published sheet within about five minutes of a change.3. Add the thermometer to your website
Paste this where the thermometer should go. Change the two lines at the top: the address you copied, and your campaign’s slug.Thermometer
4. Switch to your group
In the script, changeapi-demo.scoutworks.app to api.scoutworks.app, and replace the sandbox key with your own. Your key needs the fundraising:read scope. Give it no other scope. In the snippet, change CAMPAIGN to your own campaign’s slug.
Notes
- The total matches Scoutworks. It counts paid donations only, without Gift Aid added.
- A campaign with no target shows the total raised and no bar.
- How fresh. The sheet reads Scoutworks every hour, and Google publishes the change within about five minutes. A donation reaches the thermometer within about an hour.
- Your own server instead. If your website has its own server, it can call
GET /fundraising-campaignsitself, keep the key in its settings, and pass only the totals to the page. The rule is the same: the key never reaches the browser.