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

Steps

  1. Open Google sheets and deploy as a web app.

  2. Write doGet and doPost 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:


  1. Debug then deploy the web app script.
  2. Copy the web app url for use later in your Journey.
  3. As an admin, log in to Simon Data.
  4. From the left navigation, expand Admin Center then click Integrations.
  5. 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.)
  1. Create a Journey with an experiment or edit an existing one.
  1. 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.
  1. 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: