PHOTO: oliviaelisa92


Automation is a holy grail in marketing. But with so many automation methods available, it can be difficult for marketers to identify where to start.

Marketers can experiment with application scripts, a JavaScript-based set of instructions similar to JSON in data. App scripts are typically used with digital ads, so you can imagine the two platforms that use them: Bing and – you guessed it – Google.

Google Apps scripts provide a way to automate the transfer of data between Google properties, allowing marketers to automate repetitive tasks. Google first introduced Apps Script in 2009 and over the years since developers have created a number of scripts. So while marketers need an appreciation for JavaScript, changes to a script to link to specific features in Google properties are not as extensive as in app or site development. Web. Many of these scripts are related to Google Sheets, but there are others. For example, there is a script for the Google Analytics Management API and the Reporting API. With these APIs, you can run reports on a subset of metrics which are then stored in a Google Sheet.

Presentation of the Google Apps script editor

To create a Google Apps script, you need to access the Google Application Script Editor, an integrated development environment (IDE). IDEs act like a sandbox, a dedicated environment for easily making corrections and exploring functions. Online programming editors like CodePen have made this arrangement popular.

When creating your script, you work with JavaScript functions. Developers typically write code, like creating variables, but in this case you have a template where you change the variables based on the features you want to automate.

First, sign in to your Google Account. This will allow you to make sure that the Script Editor recognizes the account. Open your browser in the Script Editor (at script.google.com), then click “Show Dashboard”. At the top left of the screen, click on the “New project” button. Once you do, it will take you to the editor. You can rename the project and save it here on the editor screen.

google application script

The Google Apps Script Editor provides commands to facilitate script development. There are three user interface menus, as well as the main editor itself. A menu on the left side of the screen is a column menu for accessing IDE functionality. You can preview your saved project script, triggers for setting up alerts and extensions, which are connections to other services.

Related article: Balancing Automation and Intelligence in Your Martech Stack

Getting Started with Application Scripts and Script File Types

The main editor will fill most of the screen. This is where you will create the script. The editor provides a generic function script by default, but you can delete this code and paste it into the code template you want to use.

Above the editor is a menu with buttons to test your model. You can run it and debug it. There is a button to deploy your script, either starting from scratch or matching it with a previously deployed script. You can also test specific functions and identify errors through an execution log that appears at the bottom of the screen.

The publisher can also create stand-alone scripts, scripts that are not exclusively used with a Google platform. Marketers can deploy these scripts as a web application, which will be useful if your script is connected to another platform.

When you want to include data from other applications, you use services. Services are API connections to other Google platforms. This is where you can select the Analytics API, but there are others like Big Query, Google Calendar, Google Docs, and Google AdSense. The API for these services must be enabled before use in a Google application script. Metrics in Google Analytics are covered as a variable. For example, you can use the visitors metric from Google Analytics in a variable using the GA: visits parameter.

There are also libraries. Libraries are extensions very similar to packages used in R programming. Libraries collect existing Google Apps scripts in one place for reuse in developing new scripts. Marketers can search libraries and locate specific assets by Script ID.

Finally, the menu in the left column includes a file menu for saving different types of scripts. There are three formats to choose from. The main one is a standard JavaScript file format. You can also save your template as a library or a service. This means that you can create custom models for specific applications.

How to best work with Google Apps scripts

Google Apps scripts can connect to over 30 built-in services to interact with user data, other Google systems, and external systems. To innovate with your automation goals, it’s a good idea to go through the documentation associated with an API so that you can understand what parameters are being extracted. You should also consult the Apps Script developer guides for ideas on what you might want to report in your Google script.

A good time to add Google Apps scripts is when reviewing the automation code that supports your campaigns. Decide whether or not the code is sufficient for your needs. Are the APIs used secure? Are the data delivered by the APIs validated? Asking such questions ensures that ingested data does not bypass any data compliance issues or create unnecessary technical debt.

Overall, Google Apps scripting gives marketers a good entry point to handle automation without requiring heavy developer skills. This is a good way for marketers to get familiar with JavaScript through the lens of a Google Apps script.

Pierre DeBois is the founder of Zimana, a digital analysis consulting firm for small businesses. It examines data from web analytics and social media dashboard solutions, then provides web development recommendations and actions that improve business marketing strategy and profitability.

About The Author

Related Posts