There are two ways to get this working. The first way is simpler (less tech-savvy) but doesn't allow for automated updates etc. The second way is more technical, but gives more of a developers workflow to the process.
Three config items are required for the BB counts script to work:
- The URL for the feed. This is typically the same as your region location landing page with "feed" at the end (e.g. http://f3nation.com/locations/fort-mill-sc/feed/)
- The fileId for your google sheet. Create a new Google Sheet and then look at the url. The fileId is the string between /d and /edit.
- The sheetName for your google sheet. This is the actual sheet name in the google sheet, which should have the following columns: Date, Categories, Count, Url
- Simply click the green "Clone or download" button at the top of the github page (likely where you are reading this) and choose download Zip.
- Go to script.google.com and create a new project (I named mine f3-automation)
- Copy the code from the download in cfg/config.js to the editor window.
- Copy the code from the download in src/backblasts.js to the editor window (same file as step 3 is fine)
- Edit the settings from the config.js copy to have the right values (see above) and save the script file.
- Click the Dropdown at the top of the page to choose the function to run (checkBackblasts).
- Review and Accept Permissions.
- Verify the rows are written in the Google Sheet.
- Click Resources -> Current Project's Triggers, select trigger to run checkBackblasts on whatever period you desire (i did 4 hours).
To create a working project, there are a few steps that must be completed.
- NodeJs installed with npm
npm install -g node-google-apps-script
npm install -g gulp
npm install
Go to script.google.com and create a new project (I named mine f3-automation). Click Resources -> Developers Console Project. On this new window, click the blue link for your project (e.g. f3-automation - project-id-abc123xyz456). In the Google API window that opens, click Credentials. Click Create Credentials and choose OAuth Client ID. For application type, choose other and give it a name. Click the download link to download a json file for your new project.
From local console window authorize the credentials downloaded.
gapps auth your-credential-file
Back in the main script.google.com page for your project, get the project id from the url. It is the value between the /d and /edit (again, we use project-id-abc123xyz456 as an example here). In this project folder, run the following command:
gapps init project-id-abc123xyz456
This will create a gapps.config.json file with the configuration needed. To use files generated into the 'build' folder open the gapps.config.json file and change the path variable from "src" to "build"
All configuration is isolated in the cfg folder in the config.js (see the Required Configuration section above). If you want out of the box behavior, this is all your have to touch. If you want to customize things beyond the config values, you can edit the source in the src folder. All source should be in the src folder and will by synchronized to the script.google.com site by running:
gulp upload
In script.google.com, go Resources -> Current Project's Triggers. Choose the proper trigger (e.g. checkBackblasts) and a schedule (E.g. hourly at every 4 hours). I also like to set a notification in case of errors here.
See here for the npm documentation on this gapps workflow and here for an article on best practices.