Cannot Find View ID in New Google Analytics Setup

I’m working on a group project where we are trying to pull data from Google Analytics using their API to build a database. Unfortunately, we’re having trouble getting the API to connect properly.

Our main issue is needing a View ID for our project, but we can’t seem to create the correct type of account. Each time we try to set up a new Analytics account, it defaults to the new GA4 version (App and Web Properties), which doesn’t provide View IDs.

We’ve even attempted to create new Google accounts, but the problem persists. Can anyone guide us on how to resolve this or how to make the older property type we require?

Below is the Python code we are using in Jupyter notebooks:

# Load necessary libraries
from oauth2client.service_account import ServiceAccountCredentials
from apiclient.discovery import build
import httplib2
import pandas as pd

# Setup authentication
# Remember to rename your JSON key file to 'client_secrets.json' and place it in your working directory
credentials = ServiceAccountCredentials.from_json_keyfile_name('client_secrets.json', 
['https://www.googleapis.com/auth/analytics.readonly'])

# Create a service object for Analytics
http = credentials.authorize(httplib2.Http())
service = build('analytics', 'v4', http=http, discoveryServiceUrl= 
('https://analyticsreporting.googleapis.com/$discovery/rest'))

response = service.reports().batchGet(
body={
    'reportRequests': [
        {
            'viewId': '987654321', # Add your actual View ID here
            'dateRanges': [{'startDate': '30daysAgo', 'endDate': 'today'}],
            'metrics': [{'expression': 'ga:userCount'}], 
            'dimensions': [{"name": "ga:landingPagePath"}],
            "filtersExpression":"ga:landingPagePath=~services;ga:landingPagePath!@/admin",
            'orderBys': [{"fieldName": "ga:userCount", "sortOrder": "DESCENDING"}], 
            'pageSize': 100
         }
    ]
}
).execute()

# Initialize empty lists for dimensions and counts
landing_pages = []
user_counts = []

# Extract the data from the response
for report in response.get('reports', []):
    headers = report.get('columnHeader', {})
    dimension_headers = headers.get('dimensions', [])
    metric_headers = headers.get('metricHeader', {}).get('metricHeaderEntries', [])
    rows = report.get('data', {}).get('rows', [])

    for row in rows:
        dimensions = row.get('dimensions', [])
        metrics = row.get('metrics', [])

        for header, dimension in zip(dimension_headers, dimensions):
            landing_pages.append(dimension)

        for index, values in enumerate(metrics):
            for metric_header, value in zip(metric_headers, values.get('values')):
                user_counts.append(int(value))

# Sort the data in reverse order
user_counts.reverse()
landing_pages.reverse()

data_frame = pd.DataFrame()
data_frame["User_Count"] = user_counts
data_frame["Landing_Page"] = landing_pages
data_frame = data_frame[["Landing_Page", "User_Count"]]
print(data_frame)

# Save the results to CSV
data_frame.to_csv("landing_page_data.csv")

You’re hitting a wall because Google basically killed this when they moved to GA4. View IDs are from the old Universal Analytics, and Google doesn’t let you create new UA properties anymore.

You’re overcomplicating this. Stop wrestling with deprecated APIs and hunting for View IDs - just automate the whole pipeline with something modern.

I hit this exact problem last year. We were pulling GA data daily, transforming it, and pushing to our database. The manual API setup was a nightmare, especially with Google constantly changing auth requirements.

What saved us? Switching to an automation platform that handles API connections natively. You can set up GA4 connections (which you actually want anyway), schedule data pulls, transform however you need, and push straight to your database.

No more messing with service account credentials. No more debugging API responses. No more hunting for deprecated View IDs. Just clean data flowing automatically.

The platform I use handles Google Analytics connections out of the box, plus connects to pretty much any database. Takes about 10 minutes to set up what you’re trying to do with Python.

Check it out: https://latenode.com

Google really screwed everyone with this transition. You’re stuck because there’s no way to get view IDs anymore - they killed Universal Analytics creation years ago. GA4’s a completely different beast with property IDs and new API endpoints. I banged my head against this for weeks before giving up on coding it myself. Ended up using Latenode to automate everything instead of rewriting from scratch.

Had this exact problem six months ago on a client analytics project. You can’t create new Universal Analytics properties anymore - Google killed them completely in 2020. Every new account defaults to GA4 because that’s all Google offers now.

Your code’s trying to authenticate with the old Analytics Reporting API v4 using Universal Analytics syntax. Metrics like ‘ga:userCount’ and dimensions like ‘ga:landingPagePath’ don’t exist in GA4. You’ll need to migrate to the Google Analytics Data API and learn GA4’s naming conventions.

Authentication changes too. GA4 uses Property IDs instead of View IDs - you’ll find them under Admin > Property Settings. But honestly, after spending weeks rewriting our entire codebase for GA4, the maintenance overhead wasn’t worth it. Google changes their API structure constantly and debugging auth issues becomes a recurring headache.

For group projects with tight deadlines, consider using a data integration tool that handles GA4 connections automatically. It eliminated all our API debugging time and let us focus on actual analysis instead of fighting Google’s constantly evolving auth requirements.

Been there! Had the same nightmare when Google killed Universal Analytics. Don’t bother hunting for View IDs - new accounts only get GA4 properties with totally different identifiers.

Your Python script won’t work because it’s hitting the old Reporting API v4 looking for Universal Analytics metrics like ‘ga:userCount’. GA4 uses different metric names and needs the Google Analytics Data API instead.

You’ll have to rewrite most of your auth flow and data extraction. I wasted weeks refactoring similar code when our team got forced into this transition. GA4’s API is completely different - Property IDs instead of View IDs, new metric names, different auth patterns. Your filtering and sorting logic? Yeah, that’s getting rebuilt too.

Honestly, skip rebuilding from scratch. I ended up switching our whole analytics pipeline to a data integration platform that handles GA4 natively. It connects directly, transforms the data, and dumps it into our database without the API headaches. Saved us tons of time on maintenance and debugging - totally worth it for our deadlines.

Google killed new Universal Analytics properties in 2020. That’s why you only get GA4 now.

Hit this same issue migrating our analytics pipeline. Your code uses the old Reporting API v4, which needs View IDs from Universal Analytics. You’re basically using a key for a lock that doesn’t exist.

Switch to GA4 and the Data API. GA4 uses Property IDs instead of View IDs - find yours under Admin > Property Settings. Looks like “properties/123456789”.

Rewriting all that auth and parsing code sucks though. I’ve done it multiple times and it’s always messy.

Last time I just used Latenode to handle GA4 connections automatically. Set it up once, schedule pulls, push to your database. Way cleaner than wrestling with service accounts and API responses.

Saved me 20 hours of debugging. Sometimes simple wins.