analytics api - Google sheets - google-analytics

I have set up the Google analytics API on Google sheets for reporting purposes, however have had some issues in capturing transaction and revenue data, when filtering.
The API pulls in revenue and transaction data fine for me when not filtering, however I've used the below filter, because this is how our website splits out our white labels, with each white label having a different affiliate id.
ga:pagePath=#/?affiliate_id=default
This pulls through the filtered session data through fine, but does not pull through transaction or revenue data.
When using Google Analytics rather than the GA API in Google sheets, the same filter works fine, and shows the transaction and Revenue data. However through the API in Google Sheets the above filter shows the transactions and revenue as 0.
Does anybody know what I've done wrong here, and what the correct code would be to enter in the filter box in Google sheets so I can pull in the transaction and revenue data?
My technical knowledge is very limited here so appreciate the help.
Many thanks!
Rob

You may want to try the queries given in Core Reporting API - Common Queries.
Like, for Revenue Generating Campaigns, to get campaign and site usage data for campaigns that led to more than one purchase through your site, you may use this query:
dimensions=ga:source,ga:medium
metrics=ga:sessions,ga:pageviews,ga:sessionDuration,ga:bounces
segment=dynamic::ga:transactions>1
And to get information on revenue generated through the site for the given time span, sorted by sessions in descending order, you may use the sample query in All Traffic Sources - E-Commerce:
dimensions=ga:source,ga:medium
metrics=ga:sessions,ga:transactionRevenue,ga:transactions,ga:uniquePurchases
sort=-ga:sessions
I also suggest that you try and explore using Query Explorer.

Related

Google Analytics API doesn't give full results for certain catalogs

We use the google analytics core reporting API for our dashboards (GA plugin in power BI application).
What we need is the transactionid and the default channel grouping. This is working well for two of our websites.
But we have an issue with one website - Both Reporting and Raw Data which does not retreive the transaction ids with the corresponding default channel grouping. However, when doing a manual export from google analytics from acquisition channels by adding transactionid as a secondary dimension, we get the right information. We do not understand what is causing this misalignment.
Dimensions Chosen: Date, Default Channel Grouping and Transactionid
Metrics: Transactions, Revenue and Sessions(optional)
I get the correct number of transactions, but the issue happens when I try to combine more than one dimension(transactionid + default channel grouping).
Can you please some advice or suggest in going about getting the right information from ?
It is confusing when it works for two websites and there is 80% transactionid missing from the third website.

enabling hourly data in google analytics

I have two view/profiles linked to my google analytics account. I want to fetch the hourly data for the current day, ie
start date:today
end date: today
with a few filters and dimensions.
Now I am getting the response for one view that means it is possible in google analytics, however for the other view its showing all the values as 0- this applies both to the gui and the api.
Can anyone suggest me how to enable it for the other view as well?
You cannot. Google Analytics needs some processing time. It might be that some data appears immediately, especially on small accounts, but it's not guaranteed and not a thing you can "enable" or count on.
Updated: Okay, that was a dumb answer. Still, there is a processing latency event in GA Premium. It is possible to get realtime data, but that's a different API with limited data (the core reporting API might return data, but no guarantees for that).
But I admit, since your problem is that you do not get data for the whole day yor have a different problem. But with a premium account you should be able to contact your account manager/technical support.

filter sheets google analytics plugin

I have implemented the Google Analytics Add-on to my Google Sheets Account.. I'm building a Dashboard for the company I work for, working in E-commerce... The issue I'm having has to do with filters (I believe)... One of the metrics we look at on a weekly basis is performance by channel (i.e. Organic, Email, Display, Direct etc..) I don't know how to create reports that spit out the data for each specific medium.. The idea is so I build this dashboard so it updates dynamically(obviously) but unless I figure out how to filter metrics like revenue and traffic by medium I'm unable to do that...
How about this query:
metric ga:transactionRevenue
dimension ga:sourceMedium
sort -ga:transactionRevenue
Screen Shot of full query Source / Medium Revenue

How to remove an e-commerce transaction?

I have implemented google analytics ecommerce tracking in my website. But there was a mistake while passing parameters to google analytics. My order get tracked but product sku code is not set.
Its a dummy order that i dont want show in any google analytics report.
Can you suggest how can i delete this order from google analytics?
I am afraid you cannot remove data from GA once it has been collected.
What you can do is:
hide it: create an Advanced segment, the transaction remains in your GA profile but at least it is not included in the reports.
make a copy: copy the profile and delete the old one (it means you lose historical data)
There is one more option:
1.- You could create a new transaction with the same amount in money, but with a negative sign. For example, if you have recored a transaction for 1,000 dollars, you could recreate it with a "-1000.00" amount. Doing this would "cancell" the wrong transaction.
Important: This will only work when the user sees a long period of time, including the wrong transaction and the fix.
Julien is right. You cannot remove the data.
There're a couple more options in addition to Julien's suggestions though
You can go to "Filters" option of the view and try to see if you can filter it out. Luckily, ecommerce transactions have their own category that can help you narrow down the variable you need to use. (screenshot attached)
Go a little more advanced than filters and use "Data Import" where you import the ecommerce transactions via a spreadsheet thereby overwriting the transactions for that day. So, what you would essentially do is take all the real transactions of ecommerce from your ecommerce application, export them to CSV and then upload it into GA without the test transaction.
Lastly, a tip: create a test profile for things like this.
One of the answers hinted at data imports (but in a way that would probably not have worked). Universal Analytics actually introduced a way to refund transactions (effectively canceling them out) via data imports. However this only works if the data was collected via enhanced e-commerce tracking. As per documentation:
In order to process refunds you need to have collected transaction
data with the ec.js plugin
With standard e-commcerce-tracking Omar Gonzales' answer is still the only working option (I'd like to add the additonal caveat that the negative transaction might be attributed to the wrong channel, so make sure to look at the source/medium/campaign data for the transaction you want to cancel out and supply that data via utm parameters).

Getting MCF Conversions path data from Google Bigquery

I am using Google Bigquery to extract data on conversion paths from Google Analytics (GA).
When I analyze these conversion paths from the exported dataset, the last-click conversions match the Acquisition report in GA, but not to the Multi Channel Funnel (MCF) data. Apparently Bigquery doesn't really export raw data, but transforms it by deleting all last direct clicks. like described here: https://support.google.com/analytics/answer/1319312?hl=en.
Is it possible to get the Bigquery data to correspond to Multi Channel Funnel (MCF) conversion path data? To undo the deletion of last non-direct click and get proper 'raw' user level data?
All of the trafficSource fields in BigQuery Export for Google Analytics use campaign attribution as described in this processing flow, which will overwrite direct traffic with the most recent campaign (if there is one and it is within the specified timeout), as you mentioned.
If you are using Universal Analytics, you can adjust the campaign timeout to be shorter than the 6 month default. For example, if you set the campaign timeout to be one day, any direct visits that come in at least one day after a visit with a campaign will be attributed to direct instead of the previous campaign. This can be done with Classic Analytics as well using _setCampaignCookieTimeout. This technique will affect data collection from the time it is implemented going forward.
This thread is rather dated, so I thought I'd update just in case anyone else comes across this same question.
There is a field that was introduced (both in the Google Analytics interface and the BigQuery export) that allows you to match the numbers in the MCF reports. In BigQuery, look for the field trafficSource.isTrueDirect
BigQuery Export Schema
trafficSource.isTrueDirect
True if the source of the session was Direct (meaning the user typed
the name of your website URL into the browser or came to your site via
a bookmark), This field will also be true if 2 successive but distinct
sessions have exactly the same campaign details. Otherwise NULL.

Resources