Company-Level Analytics with RudderStack and BigQuery

In the competitive world of B2B SaaS, understanding your customers is key to success. But how do you go beyond individual user behavior and gain insights into how companies interact with your product? The answer lies in company-level analytics, and this blog post will guide you through setting up a robust event-tracking system using RudderStack and Google BigQuery to achieve just that.

Why Company-Level Analytics Matters

While individual user data is valuable, B2B SaaS businesses often need to understand how entire organizations use their product. This includes tracking:

By analyzing data at the company level, you can identify trends, tailor your marketing efforts, and optimize your product for specific customer segments.

Introducing RudderStack and Google BigQuery

RudderStack is an open-source Customer Data Platform (CDP) that simplifies data collection and routing. It acts as a central hub, capturing events from your website, app, and servers, and sending them to various destinations, including your data warehouse.

Google BigQuery, on the other hand, is a powerful, serverless data warehouse that can handle massive datasets with ease. It's the perfect place to store and analyze your event data, especially when dealing with the volume and complexity typical of B2B SaaS.

Setting Up Your Event Tracking System

Here's a step-by-step guide to get started:

  1. Configure RudderStack:
    • Sign up for a RudderStack account and set up your sources (website, app, etc.).
    • Install the relevant RudderStack SDKs in your application.
    • Use the Event Playground to test and verify your event tracking setup.
  2. Connect RudderStack to BigQuery:
    • Create a Google Cloud Platform (GCP) project and enable billing.
    • Create a new bucket in Google Cloud Storage for BigQuery.
    • Create a service account with necessary permissions (Storage Object Admin, BigQuery Job User, BigQuery Data Owner).
    • Generate a JSON key for the service account.
    • In RudderStack, add BigQuery as a destination and provide the connection settings.

Adding the "Group" Dimension

Now, let's add the crucial "group" information to your events. This allows you to associate users with their respective companies and perform company-level analysis.

RudderStack provides the group call for this purpose. Here's how it works:

Example code (JavaScript):

// Identify the user
rudderanalytics.identify('user-123', {
  email: 'john.doe@example.com',
  name: 'John Doe'
});

// Associate the user with a group
rudderanalytics.group('company-abc', {
  name: 'Acme Corp',
  industry: 'Technology',
  employees: 500
});

Analyzing Your Data

Once you have events flowing into BigQuery with the "group" information, you can start performing company-level analysis. Here are some examples:

Track feature usage by company

See what companies are using "create_team" feature the most.

SELECT g.name, COUNT(*) AS event_count
FROM `test_events.tracks` AS e
JOIN `test_events.groups` AS g ON e.context_group_id = g.group_id
WHERE e.event = 'create_team'
GROUP BY g.name
ORDER BY event_count DESC;

The example query returns statistics about "Create Team" event by organization:

Identify latest companies having ended their trial period

SELECT g.name, MAX(g.timestamp) AS latest_timestamp
FROM `test_events.tracks` AS e
JOIN `test_events.groups` AS g ON e.context_group_id = g.group_id
WHERE e.event = 'trial_ended'
GROUP BY g.name
HAVING COUNT(*) > 1
ORDER BY latest_timestamp DESC;

The example query returns organization names for companies that have ended the trial period associated with the latest event timestamp.

Best Practices

Conclusion

By combining RudderStack's event tracking capabilities with BigQuery's powerful analytics engine, and incorporating the "group" dimension, you can unlock a treasure trove of insights into your B2B SaaS customers. This data-driven approach empowers you to make informed decisions, optimize your product, and drive sustainable growth.

If you want to skip the analytics, writing SQL queries and stop waiting days for product growth insights try GrowthCues instead. It connects with your RudderStack + BigQuery stack in a swift and delivers you with product growth insights in 30 minutes!

Take care 👋,

-Toni / Builder of GrowthCues

get ai-native product analytics TODAY - start your free trial