Introduce Automation to the Marketing Flow With Google Apps Scripts - CMSWire

dipping a toe in the water
PHOTO: oliviaelisa92

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.

One place for marketers to experiment is with apps scripts, a JavaScript based set of instructions similar to JSON in data. Apps 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 offer a way to automate data movement between Google properties, allowing marketers to automate repetitive tasks. Google first introduced Apps Script in 2009 and in the years since, developers have created a number of scripts. So while marketers will need an appreciation of JavaScript, making modifications to a script to link to specific features in the Google properties are not as extensive as in app or website development. Many of these scripts link to Google Sheets, but there are others. For example, there is a script for the Google Analytics Management API and Report API. With these APIs, you can run reports on a subset of metrics which then gets stored in a Google Sheet.

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.

When creating your script you are working with JavaScript functions. Developers typically write the code, such as creating variables, but in this case you are given a template in which you modify variables based on the features you want to automate.

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.

google app script

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.  

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

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.

Overall Google Apps Scripts provides marketers with a good entry point to manage automation without requiring heavy developer skills. It's a nice way for marketers to get familiar with JavaScript through the lens of a Google Apps Script.

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.

Comments

adsT

Popular posts from this blog

What Is Voice Access in Windows 11 and How to Use It - Beebom

10 Best AI Translation Software & Tools (July 2024) - Unite.AI

Tableau vs. Google Data Studio: Complete Comparison (2024) - Simplilearn