- Easy Setup: No business verification required like Google Ads
- Free Account: Create a free HubSpot account instantly
- Rich Data: Access contacts, companies, deals, and marketing data
- Simple OAuth: Standard OAuth2 flow with no special approvals
- Go to hubspot.com
- Click "Get HubSpot free"
- Fill in basic information and create account
- Complete the quick onboarding (can skip most steps)
- You now have a free HubSpot account with CRM access!
- Go to developers.hubspot.com
- Sign in with your HubSpot account
- Click "Create App" or "Manage Apps"
- Click "Create App"
- Fill in app details:
- App Name: "Google Sheets Data Connector"
- Description: "Import HubSpot data into Google Sheets"
- Click "Create App"
- Go to the "Auth" tab in your app
- Set redirect URL:
(Replace YOUR_SCRIPT_ID with your actual Apps Script ID)
https://script.google.com/macros/d/YOUR_SCRIPT_ID/usercallback - Select required scopes:
contacts(to read contact data)content(to read general content)crm.objects.companies.read(for company data)crm.objects.deals.read(for deals data)
- Note your Client ID (starts with numbers)
- Note your Client Secret (long string)
- Keep these secure - you'll need them for Apps Script
In your Apps Script project:
- Go to Project Settings > Script Properties
- Add these properties:
HUBSPOT_CLIENT_ID = your_client_id_from_step_2
HUBSPOT_CLIENT_SECRET = your_client_secret_from_step_2
In HubSpot.gs, the redirect URI should automatically use your script ID, but verify:
var redirectUri = 'https://script.google.com/macros/d/' + ScriptApp.getScriptId() + '/usercallback';function testHubSpotSetup() {
var result = testHubSpotConnection();
Logger.log(result);
}function testHubSpotData() {
var config = {
dimensions: ['firstname', 'lastname', 'email'],
metrics: ['num_contacted_notes'],
dateRangeComputed: {
start: '2024-01-01',
end: '2024-12-31'
},
limit: 10
};
var result = executeHubSpotReport(config);
Logger.log(result);
}- Dimensions: First Name, Last Name, Email, Phone, Company, Job Title, Create Date, Lifecycle Stage
- Metrics: Contact Notes, Website Visits, Email Opens, Email Clicks
- Dimensions: Company Name, Domain, Industry, City, State, Country
- Metrics: Number of Employees, Annual Revenue
- Dimensions: Deal Name, Deal Stage, Pipeline, Close Date
- Metrics: Deal Amount, Conversion Events
-
Contacts Overview
- First Name, Last Name, Email, Company, Create Date
- Contact Notes, Website Visits
-
Companies Report
- Company Name, Domain, Industry, City, State
- Number of Employees, Annual Revenue
-
Sales Pipeline
- Deal Name, Deal Stage, Pipeline
- Deal Amount
Solution: Ensure the redirect URI in HubSpot app exactly matches your Apps Script ID
Solution: Add required scopes in your HubSpot app configuration
Solution:
- Check if your HubSpot account has contacts/companies/deals
- Verify date ranges are appropriate
- Add sample data to test with
Solution: Re-authenticate through the UI - refresh tokens may have expired
- HubSpot account created
- HubSpot app created with correct redirect URI
- Required OAuth scopes configured
- Client ID and Secret added to Apps Script properties
- Test authentication working
- Test data retrieval working
- Sample reports executing successfully
If your HubSpot account is empty, add some sample data:
-
Add Sample Contacts:
- Go to Contacts > Create Contact
- Add a few test contacts with names, emails, companies
-
Add Sample Companies:
- Go to Companies > Create Company
- Add test companies with names, domains, industries
-
Add Sample Deals:
- Go to Deals > Create Deal
- Add test deals with names, amounts, stages
Once HubSpot is working:
- Your users can connect their HubSpot accounts
- Import contact lists, company data, and sales pipeline reports
- Schedule regular data refreshes
- Use the same framework to add more data sources
The HubSpot integration provides valuable CRM data that complements your existing GA4 analytics, giving users a complete view of their marketing and sales funnel.