Automation is a holy grail in marketing. But with so many automation methods available, it can be overwhelming for marketers to identify where to get started.
An Introduction to Google Apps Script Editor
To create a Google Apps Script you need to go to the Google app script editor, an integrated development environment (IDE). IDEs act as a sandbox, a dedicated environment to easily make corrections and explore functions. Online programming editors like CodePen have made this arrangement popular.
Start by signing into your Google Account. Doing so will allow you to make sure the script editor recognizes the account. Open your browser to the script editor (at script.google.com) and then click “View Dashboard.” At the top left of the screen, click the button “New Project.” One you do, it will take you to the editor. You can rename the project and save it here on the editor screen.
The Google Apps Script editor provides controls to assist with the script development. There are three user interface menus, along with the main editor itself. One menu on the left side of the screen is a column menu for accessing IDE features. You can access an overview of your saved project script, triggers to set up alerts, and extensions, which are connections to other services.
Related Article: Balancing Automation and Intelligence in Your Martech Stack
Getting Started With Apps Scripts and Script File Types
The main editor will fill the majority of the screen. This is where you will create the script. The editor provides a default generic function script, but you can delete this code and paste in the code template you want to use.
Above the editor is a menu with buttons for testing your template. You can run and debug it. There’s a button for deploying your script, whether starting from scratch or matching it with a previously deployed script. You could also test specific functions, and identify errors through an execution log that appears at the bottom of the screen.
The editor can also create standalone scripts — scripts not exclusively used with a Google platform. Marketers can deploy these scripts as a web app, which will help if your script will be connected to another platform.
When you want to include data from other applications, you use services. Services are the API connections to other Google platforms. This is where you can select the analytics API, but there are others such as Big Query, Google Calendar, Google Docs and Google AdSense. The API for these services must be enabled prior to usage within a Google apps script. Metrics within Google Analytics are covered as a variable. For example, you can use the Google Analytics visitor metric within a variable by using the GA: visits setting.
There are also libraries. Libraries are extensions very similar to the packages used in R programming. Libraries collect existing Google Apps Scripts in one place for reuse in new script development. Marketers can search the libraries and locate specific assets by script ID.
How to Best Work With Google Apps Scripts
Google Apps Scripts are able to connect with over 30 built-in services for interacting with user data, other Google systems and external systems. To get innovative with your automation goals, it is a good idea to go through the documentation associated with an API so you can understand what parameters are being pulled. You should also review the Apps Script developer guides to get some ideas on what you may want to report within your Google script.
A good time to add Google Apps Scripts is when conducting a code review on the automation supporting your campaigns. Decide whether or not the code is sufficient for your purposes. Are the APIs in use secure? Is the data delivered by the APIs validated? Asking questions like these ensures the data being ingested is not circumventing any data compliance concerns or creating unnecessary technical debt.
Pierre DeBois is the founder of Zimana, a small business digital analytics consultancy. He reviews data from web analytics and social media dashboard solutions, then provides recommendations and web development action that improves marketing strategy and business profitability.