Are you looking to integrate your Stripe and Google Analytics data? If your answer is yes, then you are in just the right place. In this blog post, you will be taken through the 2 aspects of doing that like how to pull transactions from the Stripe API directly into Google Sheets and then moving the data from Google Sheets to Google Analytics. Data can be moved into Google Sheets using the API Connector add-on for Google Sheets. Stripe is a widely used payment processor which is very well known for its amazing APIs.

Here’s what you will be looking at

Table of Contents

Integrating Stripe and Google Analytics

The first step is to obtain an API key from Stripe and then set up a request to load metrics from Stripe to your spreadsheet.

  • Step 1: Obtaining the Stripe API Key
  • Step 2: Generate an API Request URL
  • Step 3: Load Stripe API Data to Google Sheets
  • Step 4: Get More Data
  • Step 5: Handle Pagination 

Step 1: Obtaining the Stripe API Key

  1. Sign in to your Stripe account and click on Developers > API keys from the left-side menu.
  1. When you land on this page, you will notice that API keys have already been generated for you automatically. You can take your pick between test data and real data; they both work in exactly the same way. (You can also use live data by simply toggling the ‘Viewing Test Data’ option). You can get the secret token by clicking on the button at the bottom of the page.
  1. After you have uncovered the secret key, save a copy of it as you will be needing it in a while. 

Step 2: Generate an API Request URL

You can easily follow the Stripe API documentation to demand a list of transactions.

  • Base URL: https://api.stripe.com/v1
  • Endpoint: /charges
  • Parameters: ?limit=#_OF_RECORDS 

The ‘limit’ parameter is not necessary, even though it is optional we will be including it to show how parameters work. When we put all of this together, we get the full API Request URL:

https://api.stripe.com/v1/charges?limit=100
Hevo, A Simpler Alternative to Integrate your Data for Analysis

Hevo offers a faster way to move data from databases or SaaS applications like Google Analytics and Stripe (Data Source Available for Free in Hevo) into your Data Warehouse to be visualized in a BI tool. Hevo is fully automated and hence does not require you to code.

Get Started with Hevo for Free

Check out some of the cool features of Hevo:

  • Completely Automated: The Hevo platform can be set up in just a few minutes and requires minimal maintenance.
  • Real-time Data Transfer: Hevo provides real-time data migration, so you can have analysis-ready data always.
  • 100% Complete & Accurate Data Transfer: Hevo’s robust infrastructure ensures reliable data transfer with zero data loss.
  • Scalable Infrastructure: Hevo has in-built integrations for 150+ Data Sources that can help you scale your data infrastructure as required.
  • 24/7 Live Support: The Hevo team is available round the clock to extend exceptional support to you through chat, email, and support calls.
  • Schema Management: Hevo takes away the tedious task of schema management & automatically detects the schema of incoming data and maps it to the destination schema.
  • Security: Hevo is SOC II, GDPR, and HIPPA compliant. Hevo also enables top-grade security with end-to-end encryption, two-factor authentication, and more.
  • Live Monitoring: Hevo allows you to monitor the data flow so you can check where your data is at a particular point in time.

Transfer Data from sources like Stripe to your target destination for Free!

Sign up here for a 14-Day Free Trial!

Step 3: Load Stripe and Google Sheets API Data

You can enter these values into the API Connector and then start importing your Stripe data into Google Sheets.

  1. Open Google Sheets and click on Open by navigating to Add-ons > API Connector > Open.
  2. When you get the Create screen, input the Request URL you just generated:
  1. Go to headers and input a key-value pair like this:
AuthorizationBearer YOUR_SECRET_TOKEN
  1. Put in the token you revealed in step 3 in place of YOUR_SECRET_TOKEN.
  1. Then create a new tab and click on ‘Set current’ to employ that tab as your data destination.
  2. Assign a name to your request and then click on Run. In a while, you will see sales data fill-up the Stripe Charges tab in your Google Sheet.

Step 4: Get More Data

To get the full list of available API requests, you can check out the Stripe documentation here, but you can also just play around with the URLs you enter in the API URL path field. You can start by trying out the following (one at a time):

Step 5: Handle Pagination 

Stripe by default returns only 10 records at a time. If you want to retrieve more, you can use the ‘limit’ and ‘starting_after’ parameters as described in the Stripe documentation, like this:

You can set the ‘limit’ value to be between 1 and 100, while the ‘starting_after’ parameter must take the name of an object ID value in your report.

In the API Connector, you will be able to run these requests separately, or loop through them automatically using pagination handling (paid feature), like this:

Creating Google Analytics Report Using Google Sheets Data

The next step is to use an Analytics add-on in Google Sheets to create the report you require. Once your data has been loaded to Google Sheets, you can clean it up, create graphs and even share your findings with your team.

Step 1: Get the Analytics Add-On

  1. If you don’t already have an account, sign up to start using Analytics.
  2. Go to Google Sheets and create a new spreadsheet.
  3. Click on Add-ons > Get add-ons.
  4. Look for the Google Analytics add-on and then click on FREE.
  5. Finally, click on Allow.

Step 2: Create an Analytics Report

  1. Open a spreadsheet in Google Sheets.
  2. Click on Add-ons > Google Analytics > Create new report.
  3. Insert your information and click on Create Report. Your analytics data will appear in a new sheet.
  4. For any further help, you can read through Google Analytics Spreadsheet Add-On.

Conclusion

In this blog post, you have learned the five-step process of moving data from Stripe to Google Analytics using Google Sheets. This process can be tedious and time-consuming.

Also, you might have valuable data in various other marketing applications that need to be brought together for a complete understanding of your customers. To do that, you need to write custom code, which can get very complicated. You can avoid all of this by trying out Hevo Data.

Visit our Website to Explore Hevo

It is a No-code Data Pipeline that can bring data from not just Stripe, but from all of your marketing applications without the headache of manual coding. You can use its simple interface to connect all major SaaS applications to your analytics or BI tool in a matter of minutes. 

You can try Hevo for free to see if it suits your needs! Sign Up here and take Hevo for a spin! You can now transfer data from sources like Stripe, Google Analytics, etc. to your target destination for Free using Hevo!

Have any further queries? Let us know in the comments section below.

Shruti Garg
Freelance Technical Content Writer, Hevo Data

With an analytical perspective and a problem-solving approach, Shruti has extensive experience in solving business problems of data teams by delivering thoroughly researched content pivotal for data practitioners.

No-Code Data Pipeline for Stripe

Get Started with Hevo