Posted by Romain Vialard, a Google Developer Expert and developer of Yet Another Mail Merge, a Google Sheets add-on.

Google Apps Script makes it easy to create and publish add-ons for Google Sheets, Docs, and Forms. There are now hundreds of add-ons available and many are reaching hundreds of thousands of users. Google Analytics is one of the best tools to learn what keeps those users engaged and what should be improved to make an add-on more successful.

Cookies and User Identification

Add-ons run inside Google Sheets, Docs, and Forms where they can display content in dialogs or sidebars. These custom interfaces are served by the Apps Script HTML service, which offers client-side HTML, CSS, and JS with a few limitations.

Among those limitations, cookies aren’t persistent. The Google Analytics cookie will be recreated each time a user re-opens your dialog or sidebar, with a new client ID every time. So, Analytics will see each new session as if initiated by a new user, meaning the number of sessions and number of users should be very similar.


Fortunately, it’s possible to use localStorage to store the client ID — a better way to persist user information instead of cookies. After this change, your user metrics should be far more accurate.

Add-ons can also run via triggers, executing code at a recurring interval or when a user performs an action like opening a document or responding to a Google Form. In those cases, there’s no dialog or sidebar, so you should use the Google Analytics Measurement Protocol (see policies on the use of this service) to send user interaction data directly to Google Analytics servers via the UrlFetch service in Google Apps Script.

A Client ID is also required in that case, so I recommend using the Apps Script User properties service. Most examples on the web show how to generate a unique Client ID for every call to Analytics but this won’t give you an accurate user count.

You can also send the client ID generated on client side to the server so as to use the same client ID for both client and server calls to Analytics, but at this stage, it is best to rely on the optional User ID in Google Analytics. While the client ID represents a client / device, the User ID is unique to each user and can easily be used in add-ons as users are authenticated. You can generate a User ID on the server side, store it among the user properties, and reuse it for every call to Analytics (both on the client and the server side).

Custom Dimensions & Metrics

In add-ons, we usually rely on event tracking and not page views. It is possible to add different parameters on each event thanks to categories, actions, labels and value, but it’s also possible to add much more info by using custom dimensions & metrics.

For example, the Yet Another Mail Merge add-on is mostly used to send emails, and we have added many custom dimensions to better understand how it is used. For each new campaign (batch of emails sent), we record data linked to the user (e.g. free or paying customer, gmail.com or Google for Work / EDU user) and data linked to the campaign (e.g. email size, email tracking activated or not). You can then reuse those custom dimensions inside custom reports & dashboards.


Once you begin to leverage all that, you can get very insightful data. Until October 2015, Yet Another Mail Merge let you send up to 100 emails per day for free. But we’ve discovered with Analytics that most people sending more than 50 emails in one campaign were actually sending 100 emails - all the free quota they could get - but we failed to motivate them to switch to our paid plan.


As a result of this insight, we have reduced this free plan to 50 emails/day and at the same time introduced a referral program, letting users get more quota for free (they still don’t pay but they invite more users so it’s interesting for us). With this change, we have greatly improved our revenue and scaled user growth.

Or course, we also use Google Analytics to track the efficiency of our referral program.

To help you get started in giving you more insight into your add-ons, below are some relevant pages from our documentation on the tools described in this post. We hope this information will help your apps become more successful!:


Romain Vialard profile | website

Romain Vialard is a Google Developer Expert. After some years spent as a Google Apps consultant, he is now focused on products for Google Apps users, including add-ons such as Yet Another Mail Merge and Form Publisher.

The APIs for three of Apps Script's advanced servicesAnalytics, BigQuery, and Prediction — will undergo breaking changes on Monday, November 18. If you don't update your code to the new syntax before then, you'll receive error messages such as Required parameter is missing.

Advanced services allow you to easily connect to certain public Google APIs from Apps Script. We're working to expand and improve our advanced services, and as a side effect some methods and parameters that were incorrectly listed as optional are now required.

On November 18, these services will switch to use the new method signatures shown in the tables below. To learn how new arguments should be structured, refer to the documentation for the underlying API. For example, the documentation for the BigQuery service's Jobs.query() method shows the valid properties for the resource object in the "Request body" section of the page.


Old New
Analytics.Management.Uploads
.deleteUploadData(
    accountId, 
    webPropertyId, 
    customDataSourceId, 
    optionalArgs)
.deleteUploadData(
    resource, 
    accountId, 
    webPropertyId, 
    customDataSourceId)
BigQuery.Datasets
.insert(
    resource, 
    optionalArgs)
.insert(
    resource, 
    projectId)
.update(
    resource,
    optionalArgs)
.update(
    resource, 
    projectId,
    datasetId)
BigQuery.Jobs
.insert(
    resource, 
    mediaData,
    optionalArgs)
.insert(
    resource, 
    projectId, 
    mediaData)
.query(
    projectId,
    query)
.query(
    resource,
    projectId)
BigQuery.Tabledata
.insertAll(
    projectId,
    datasetId, 
    tableId,
    optionalArgs)
.insertAll(
    resource,
    projectId, 
    datasetId, 
    tableId)
BigQuery.Tables
.insert(
    resource,
    optionalArgs)
.insert(
    resource, 
    projectId,
    datasetId)
.update(
    resource, 
    optionalArgs)
.update(
    resource, 
    projectId,
    datasetId,
    tableId)
Prediction.Hostedmodels
.predict(
    project, 
    hostedModelName, 
    optionalArgs)
.predict(
    resource,
    project, 
    hostedModelName)
Prediction.Trainedmodels
.insert(
    project, 
    optionalArgs)
.insert(
    resource,
    project)
.predict(
    project, 
    id, 
    optionalArgs)
.predict(
    resource, 
    project, 
    id)
.update(
    project, 
    id, 
    optionalArgs)
.update(
    resource, 
    project, 
    id)

If you want to prepare your code ahead of time, you can add a try/catch around your existing code that retries with the new method signature if the old one fails. For example, the following sample applies this approach to the BigQuery service's Jobs.query() method:

  var result;
  try {
    result = BigQuery.Jobs.query(projectId, query, {
      timeoutMs: 10000
    });
  } catch (e) {
    // Refer to the BigQuery documentation for the structure of the 
    // resource object.
    var resource = {
      query: query,
      timeoutMs: 1000
    };
    result = BigQuery.Jobs.query(resource, projectId);
  }

We apologize for inconvenience and look forward to sharing exciting news about advanced services in the coming weeks.


Eric Koleda profile

Eric is a Developer Programs Engineer based in NYC on the Google Apps Script team. He's previously worked with the AdWords API and enterprise content management software.

Editor's note: This has been cross-posted with the Google Analytics blog and the Google Developers blog -- Jan Kleinert

Many people have been asking for a simple way to put Google Analytics data into a Google Spreadsheet. Once the data is inside a Google Spreadsheet, users can easily manipulate Google Analytics data, create new visualizations, and build internal dashboards.

So today we released a new integration that dramatically reduces the work required to put Google Analytics data into any Apps Script supported product, such as Google Docs, Sites, or Spreadsheets.

Here’s an example of Google Analytics data accessed through Apps Script and displayed in a Google Spreadsheet.

Custom API Dashboards - No Code Required

We know that a popular use case of this integration will be to create dashboards that automatically update. To make this easy to do, we’ve added a script to the Spreadsheets script gallery that handles all this work - no code required. The script is called Google Analytics Report Automation (Magic).

This script is a great template for starting your own project, and we’ve had many internal Google teams save hours of time using this tool. Here’s a video demoing how to build a dashboard using this script:

You can find this script by opening or creating a Google Spreadsheet, clicking Tools -> Script Gallery and searching for “analytics magic”.

Writing Your Own Script

Of course many developers will want to write their own code. With the new Analytics – Apps Script integration, you can request the total visitors, visits, and pageviews over time and put this data into a spreadsheet with just the following code:

// Get Data.
var results = Analytics.Data.Ga.get(
    tableId,
    startDate,
    endDate,
    'ga:visitors,ga:visits,ga:pageviews',
    {‘dimensions’: ‘ga:date’});

// Output to spreadsheet.
var sheet = SpreadsheetApp.getActiveSpreadsheet().insertSheet();
sheet.getRange(2, 1, results.getRows().length, headerNames.length)
    .setValues(results.getRows());

// Make Sandwich.

To get started now, read our Automated Access to Google Analytics Data in Google Spreadsheets tutorial. Also check out the Google Analytics Apps Script reference docs.

Solving Business Problems

Are you ready to start building solutions using Google Analytics and Google Apps Script?

We’d love to hear new ways you use this integration to help manipulate, visualize and present data to solve business problems. To encourage you to try out this integration, we are giving out Google Analytics developer t-shirts to the first 15 developers to build a solution using both APIs.

To be eligible, you must publish your solution to either the Chrome Web Store or the Spreadsheets Script Gallery and include a description of a business problem the script solves. We’ll then collect these scripts and highlight the solutions in an upcoming blog post. After you publish your script, fill out this form to share what you’ve built.

We’re looking forward to seeing what you can do with this integration.

Nick Mihailovski   profile

Nick is a Senior Developer Programs Engineer working on the Google Analytics API. In his spare time he likes to travel around the world.

Thanks to everyone who participated in the first Marketing Test Kitchen initiative: “Add to Apps" button. Overall, it was a huge success. The number of vendors using “Add to Apps” buttons grew significantly, causing a large increase in installs driven by button traffic. Before kicking off the second Apps Ecosystem Marketing Test Kitchen initiative, we want to recognize the winners of the first one.

Congratulations to the 6 winners, who will get additional exposure on the featured and notable section of the Marketplace front page:
Outright, Producteev, Insync, Mavenlink, Zoho and Manymoon

Established vendors such as Manymoon and Zoho improved performance of existing buttons and newer folks like Outright and Producteev added buttons to capture new business. If you didn’t get your button up for last week’s contest, that doesn't mean you shouldn’t do it now! Adding a button helps improve your overall performance in the Marketplace and will prepare you for future initiatives.

Now let’s take a look at the next Marketing Test Kitchen...

The Next Challenge:
Publish your most compelling customer success stories by Thursday, Dec 2nd on your own blog and share it with us at marketing-test-kitchen@google.com. We will feature a few of the top stories on the Google Enterprise Blog (see examples here and here) and also rotate the winning vendors into the featured and notable sections on the Marketplace front page. Note we will feature every submission in the Marketplace Success Stories blog, so just by submitting a story you will end up on the front page of the Marketplace.

It’s easy to participate: Find a compelling customer, tell their story, publish it on your blog, share it with us, and track your performance.

What makes a compelling customer?
It is important to find a customer that demonstrates the value of your integrated features with Google Apps. Make sure that your customer gives explicit approval for using their story. Here are some qualities of a compelling customer.
  • Highlights the value of your app: For example, their use of your app in conjunction with various other web apps, such as other Marketplace apps.
  • Hard data to support success: Numbers that justify strong gains are important, ie: 50% productivity gains, 10% increase in revenue, 20% reduction in IT costs.
  • Passionate about Google Apps and the cloud: A genuinely passionate customer can explain the advantages of a cloud-based business and more easily help prospects understand and transition.
How can I make it easily consumable?
You can use the standard template from the developer site or find a more creative way to deliver it. You can create your own format that tells the story of the customer’s success. Here are some ideas to go beyond a typical blog post:
  • Be visual: Use tools such as Picnik and Aviary to tell your story with compelling visuals (or choose another creative tool).
  • Organize your presentation: You can use Google Presentations or SlideRocket to succinctly tell your story.
  • Use video: Shoot or animate a video of your customer telling their Apps Marketplace story.
  • Be creative: Combine the above ideas, write a story, or come up with something totally different.
To get a feel for different tones and stories, read some customer stories from various vendors on the Marketplace Success Stories blog. Also check out this example of a strong customer story that uses many of the above elements.



It’s easy to be a part of this new Marketing Test Kitchen. Just find a compelling customer, use a clever way to tell their story, publish it to your blog and share it by email. If you need more time, email us with your ideas as well! Make sure to track the performance of your blog post (and all other marketing efforts) through Google Analytics, learn how to code links and track traffic on the developer site.

Come up with the next Marketing Test Kitchen: Submit your idea via Buzz or email. We’ll evaluate the ideas and use the best ones for future initiatives. If we choose your initiative, we’ll give you a special prize.

Posted by Harrison Shih, Associate Product Marketing Manager, Google Apps Marketplace

Want to weigh in on this topic? Discuss on Buzz

The Google Apps Marketplace team is always looking for ways to help its vendors add new users and improve installation metrics. In order to help achieve these goals, we have launched the Apps Ecosystem Marketing Kitchen. Through experimentation, we want to collectively identify, test, and share best marketing practices for business web app.

The first initiative we cooked up is designed to help you, as a vendor, minimize the abandonment rate of Marketplace prospects as they bounce around your Marketplace property and various product pages without clear a “call to action”.


The Challenge:
The vendors who drive the most traffic and installs to their Marketplace listing page through their “Add to Apps” button between Nov 9th - 16th will be included in the front page Featured and Notable sections on the Apps Marketplace site.


Why participate in the challenge and use an “Add to Apps” button?
The “Add to Apps” button will improve your listing’s performance.
  1. Increase Conversions: Reduces the risk of users getting lost while navigating between the Marketplace and your website, which will result in a better experience for users and more installs for you.
  2. More Accurate tracking: Properly encoding the button URL using Google Analytics will enhance data-driven tracking so that we can better work together to understand and improve the user acquisition funnel.
  3. Bonus - Get a front page feature: The six (6) top traffic/install drivers during the challenge time-frame will be featured on the homepage. We will list:
    • The top two (2) traffic/installs drivers by pure volume.
    • The top four (4) in traffic/install growth from previous weeks.
If you already use an “Add to Apps” button, then you are one step ahead. If not, add one to get in on the challenge. We will start tracking on November 9th, so you’ll want to get started properly coding and testing your button.


How do I participate and succeed in this test kitchen challenge?
  1. Add the “Add to Apps” button properly.
  2. Make sure the page is the “Vendor product home page” link in your listing on the Marketplace
  3. Use marketing techniques to drive traffic through your landing page and potentially get featured on our front page.
  4. Use analytics to check visits made through the “button” medium, and see your traffic flowing to your app.

This test kitchen should be an exciting way to cook up some tasty campaigns. If you have any good ideas or suggestions, pass them along to marketing-test-kitchen@google.com. Check for new challenges on this blog. In order to stay on top of any news on initiatives, also follow our Buzz, Twitter, and subscribe to our email list.

Posted by Harrison Shih, Associate Product Marketing Manager, Google Apps Marketplace

Want to weigh in on this topic? Discuss on Buzz