google-analytics

Different report results between Google Analytics 4 UI and Google Data API data

Different report results between Google Analytics 4 UI and Google Data API data Question: I have a list of customers set in GA4 and I am using the google API analytics for GA4 to retrieve daily the traffic metrics for reporting purposes. Checking the metrics day by day, I noticed a lot of differences in …

Total answers: 1

Google Analytics Internal Server Error 500

Google Analytics Internal Server Error 500 Question: I am trying to build an API call to retrieve google analytics data. This API call was working and now it returns the error : <HttpError 500 when requesting https://analyticsreporting.googleapis.com/v4/reports:batchGet?alt=json returned "Internal error encountered.". Details: "Internal error encountered."> So the body of the code I got was from …

Total answers: 1

Python If/else behaving incorrectly (or I'm just dumb)

Python If/else behaving incorrectly (or I'm just dumb) Question: I’m still a beginner, so I’m sure the issue is in some silly thing I did. Basically, I’m trying to figure out websites that have only one or the two versions of Google Analytics (UA –> Universal analytics, and GA4 –> Google Analytics 4). The best …

Total answers: 1

Oauth redirects to localhost when hosted on server

Oauth redirects to localhost when hosted on server Question: I hope you can help. This script works locally for Google Analytics Auth, but when I put it on my server & run it with python3 xxx.py and go to the auth URL it redirects to localhost, which fails because it’s on the server. Does anyone …

Total answers: 1

BigQuery | Python | Export data from BigQuery table VIEW

BigQuery | Python | Export data from BigQuery table VIEW Question: This is a simple code to export from Biq Query to Google storage, in CSV format def export_data(): client = bigquery.Client() project = ‘xxxxx’ dataset_id = ‘xxx’ table_id = ‘xxx’ bucket_name = ‘xxx’ destination_uri = ‘gs://{}/{}’.format(bucket_name, ‘EXPORT_FILE.csv’) dataset_ref = client.dataset(dataset_id, project=project) table_ref = dataset_ref.table(table_id) …

Total answers: 2

invalid_client: The OAuth client was not found. Python

invalid_client: The OAuth client was not found. Python Question: I have an old project, that is trying to retrieve data from google analytics. It is not working, so I am trying to figure out what’s wrong. Found an example code to work with Analytics on server side. scope = [‘https://www.googleapis.com/auth/analytics.readonly’] key_file_location = ‘secrets.json’ credentials = …

Total answers: 1

website visit using python requests doesn't count in google analytics

website visit using python requests doesn't count in google analytics Question: website visit using python requests doesn’t count in google analytics real time I am using python requests module and google counts the visit but not found in google analytics real time (active users) my code is below: import requests import time agent_android = ‘Mozilla/5.0 …

Total answers: 2

Deploying Google Analytics With Django

Deploying Google Analytics With Django Question: We’re about to deploy a new Django website, and we want to use Google Analytics to keep track of traffic on the site. However, we don’t want all of the hits on development instances to contribute to the Google Analytics statistics. There are a few ways we could deal …

Total answers: 10