Send contact results from a Journey experiment to Google Sheets
Advanced, Integrations
Goal(s)
Send data from a Journey downstream to Google sheets using an Outbound Webhook action
Prerequisites
- Knowledge of how to use the Google Sheets Apps Script to deploy the sheet as a web app and write a function to POST the data into the sheet.
- Journeys knowledge
- Outbound webhook knowledge
Steps
-
Open Google sheets and deploy as a web app.
-
Write
doGet
anddoPost
functions for the fields you want to populate in your sheet from Simon into the Google Apps Script, similar to this example using Email Address:function doGet () { return HtmlService.createHtmlOutput("request received"); } function doPost(e) { const ss = SpreadsheetApp.getActiveSpreadsheet(); const dataSheet = ss.getSheetByName('Data'); const emailArray = []; const params = JSON.parse(e.postData.contents); //single const emailAddress = params.emailAddress; emailArray.push(emailAddress); dataSheet.appendRow(emailArray); }
Need more detail? Click below to for a walkthrough of the code sample above:
📖
Google Apps Script to load email addresses
Open Recipe
- Debug then deploy the web app script.
- Copy the web app url for use later in your Journey.
- As an admin, log in to Simon Data.
- From the left navigation, expand Admin Center then click Integrations.
- Enters
script.google.com
into a field then save. (Be sure to check with your account manager about which of these fields is currently available. Learn more here.)
- Create a Journey with an experiment or edit an existing one.
- Add an Outbound Webhook action step with a single payload structure and the parameter you're calling in your Google Apps script, after the experiment you want to collect results from, then test it.
- Publish your Journey then watch the results flow in to your sheet.
Notes
- If you need to stop the results entering your sheet you can either stop the Journey or cancel your endpoint in the Google Apps Script you created.
- If you redeploy the script at any time, you need to update the endpoint in the outbound webhook action.
Take it a step further
Want to use this same webhook in a future Journey or another action step? No need to re-write, simply choose Copy from Previous in the Webhook Request Details and choose the Journey you just created above:
Updated over 1 year ago