Google Analytics Cost Upload- a hands on Tutorial
This tutorial will show you how to pull data directly from the Bing Ads API and upload it into Google Analytics using the new Cost upload capability.
Even if you don’t use Bing, or have other sources such as files or databases, this tutorial will show you how to use the upload capability with those- Analytics Canvas can handle all of your upload needs, as well as give you the option of automating the entire process.
To learn how to connect to Bing Ads with the API, check out this tutorial first, which will get your Yahoo/Bing Ads network data linked into the Canvas, and ready to go.
An important point to be clear on that the only data that can be added or deleted from Google analytics is your uploaded data- at no time can you accidently delete any web analytics data.
Also, any data you do upload you can delete again, so you can test this upload while being sure you can undo your test later. However if you have a test profile, this would be the best place to start, to ensure that no existing reporting is effected.
There is a quota in effect for the cost upload API, for the beta you are limited to 500 uploads per day (loading data into a given date counts as one upload- so for example loading a months worth of data will consume 30 uploads). If you feel you will need more than this quota, contact us and we can discuss different subscription options.
Uploading Data into Google- how it works
To upload data into Google analytics, first a “Custom data source” must be created in a Web property. This custom data source can then be linked to one or more profiles within that property, and any data uploaded will only be visible in those linked profiles.
To create a custom data source, you have to have been white listed (link above) and then you need to go into the “Admin” for the web property, and select the “Custom Definitions” tab:
You can learn more directly from the Google documentation here.
Once the custom data source is created, you can let Analytics Canvas handle all the uploading, API calls and management of data.
First, authorize Analytics Canvas to Write into Google Analytics
By default, in versions before V1.6 when you authorize Analytics Canvas, you have read only access. To upload cost data, you need to re-authorize the application to write into Google Analytics too. When you authorize the new account, you will see that there is now a selection as to if the authorization includes cost upload or not:
In this example, we’ll look at how you can upload the data that we imported in from the previous example from Bing Ads, but the data you are uploading could be from anywhere- Analytics Canvas imports from text files, excel files and databases.
Once you do, you will see the following: The export block will automatically map columns, linking the Bing Ads data structure to the Google Analytics Data structure.
Of course we are using Bing just as an example- the data source in could be anything containing cost data with the appropriate information- a file, and excel spreadsheet, a link to a database table.
The red areas indicate things that need to be configured. At the right, we can see we need to define the source and the medium. It is very important to match exactly the UTM encoding used in the bing ads, so that Google Analytics can join this cost data to the visit data. If you use different source/medium for different accounts, then you need to upload each data set separately, or include the source, medium in the input data and map to those columns. This can be done using additional blocks, but we won’t go into that detail for this first example.
To fix a value for the source and medium, right click on the fields that are red, and enter a value.
Do the same for the medium- again, the key is to match exactly the UTM coding. If it does not match, then the cost data will be visible in Google analytics, but will not link to the visits involved.
Finally, you need to select which of the Custom data sources you created using the Google Analytics Web UI you want the data to be uploaded into, to do this, click on “Select custom data source” and you will see a view of all your web properties. Click on the web property that has the custom data source, and all the custom data sources will be listed.
Pick the one you want the data to be uploaded into and press OK.
Now, you are ready to actually write the data up. To do this, simply run the canvas using the “Full run with write to all outputs”. This will query the data from bing, and write it up, a day at a time, into the Google Analytics custom data source. The Google API requires you to upload a single CSV file for each day- Analytics Canvas is taking care of that for you, by going through the incoming data, and generating the files behind the scenes as required, and uploading.
It does take a while for this uploaded data to be visible in Google Analytics, so don’t be surprised if some hours go by before you see it. However you can confirm immediately with Analytics Canvas that it has been successfully uploaded- read on!
The next step- managing your Google Analytics Data
Wait a second, you might be thinking, what if I upload the wrong data, or something gets corrected?
First, when you are uploading, when you upload data again over previous data Analytics Canvas ensures that all the data in the date range involved gets replaced by the new data- this is done by the selection on the export block shown here. While it is also possible to append data rather than replace it, we’ll leave this more advanced functionality for a future tutorial.
It is also possible to see what dates have data in each custom data source, and to delete data either for specific dates, or for wide ranges of dates. To do this, go to the top menu and select “API Management” and then “Google Analytics uploaded data”
This will bring you to an explorer that will let you look at any custom data source, and query what data is available in any given date range.
You can look at the most current view for each date to determine what data is uploaded now, and you can also look at a detailed log of a given dates data to see what actions have been done (a record of the various uploads, deletes or appends that have been done.)
Deleting data from Google Analytics
First, again lets be clear that the only data that can be added or deleted from Google analytics is your uploaded data- at no time can you accidently delete any web analytics data.
To delete data, select the current data tab, and select which dates you wish to have data deleted from. As you can see- the selected rows are the ones that will be deleted.
Selecting all the rows will delete the entire date range.