Importing Cost Data Into Google Analytics

Want to upload your Cost data from Facebook, Bing or Twitter to Google Analytics? GA gives you the ability to import data directly from the Admin section in your GA account.

You need to prepare a proper formatted sheet of data and tell GA what data it entails. Then it’s ready to be uploaded.

Links mentioned in the video:
Google Sheets:
Cost data upload (Google):

In this video, I’m gonna show you how you can import your cost data into your Google Analytics account. All that and more coming up right after this. (lively techno music) Hi there and welcome to another video of where we teach you the data-driven way of digital marketing. My name is Julian and on this channel, we do marketing tech reviews, tips and tricks on better tracking, and tutorials just like this one. So if you haven’t yet, consider subscribing. 

Now today we want to talk about cost data import in Google Analytics. There are different ways of sending data to Google Analytics most of the time it’s sent by the tracking code itself that displays on your website, but you can also use for example the measurement protocol to send data in. Another method that we want to talk about today is importing data directly into your Google Analytics. That can be done in the admin section. There are different data types that you can send in, about your customers, about your refund data. Specifically today we want to talk about how to import your cost data into Google Analytics. We’ve got lots to cover, so let’s dive in. Today our journey starts in our Google Analytics account. Now I’m here under our acquisition report, campaigns, and cost analysis. And here’s where you can see all the costs for our campaigns, and we don’t have any cost data available in this report and that’s something we want to change. So I’ve seen our report about Facebook, there’s one target that I want to upload data from. So here’s our Facebook CPC campaign that we have run in one week of May and there are data available that we want to get out of Facebook and import into Google Analytics. So how would we actually import this column of cost data into Google Analytics? There are two ways, one is programmatically through the API, but if that’s not something that’s happening all the time, you can also go ahead and upload that data directly in the Google Analytics interface. For that, you go over to the admin section, and under data import, you can manage your different data uploads. 

Now I have something prepared here already but let’s go through the steps again. We want to upload data that is associated with costs. Now there are many other types of data that you can import but we will go with the cost data option. Let’s continue here, give this all a name, I’m just gonna call this Facebook 1 because we already have one demo Facebook data point. Then you can select the views that you want to implement this data. I’ll just go with the master’s view, but obviously, you could choose other views as well. Let’s go ahead and click continue and this will give us the data schema we need to implement. What that means we’ll discover in a second. Now the data that we upload will be in a spreadsheet format. In order to tie the data together that is already within Google Analytics, you need to provide some information so Google Analytics can match up the data correctly. This data would be the data, medium, and source. Additional data if you want to implement, obviously you want to upload the cost data. So we can select the keys here that we want to additionally implement, so we have clicks, costs, and impressions. Okay that should do it, now we have that data available. You can associate more data points with this, more dimensions really, depending on how granular you want to go with your analysis. There is, for example, the ad content, ad group if you have any kind of distinction here that you want to implement that’s something you could do as well. But we will leave this out for now. 

Last but not least we need to choose the import behavior. So if there are rows that are doubled, for example, in the date that we upload, do we just take these rows and sum them up, or do we override them? Now we will go with the summation by default. Let’s save this and now we are ready to upload data. And what Google Analytics provides us is the actual data set schema, so we will be able to look at how Google Analytics expects the data to be. So let’s go here to manage uploads and actually look at get schema. This will provide all the information that we have inputted previously, and it will actually give us an Excel template that we can download and use to upload the data. I have this template already opened up in a Google Sheet, so this is what it would look like. The header rows are just these that we saw earlier here in our header. Now we need to fill that with data, where do we get that data from? Obviously, your provider generated the traffic for you. So now okay, it’s Facebook. So let’s head over to Facebook. So here we are in our Facebook advertising account and I have right here the different campaigns that we were running and the cost data associated with it. Now the first thing is to choose the right date range that we want to provide this data for. So let’s go back to our Google Analytics account and just see where we want to implement the data. Let’s go back here to our report. Right here we see it was the 12th of May til the 19th. So let’s go back and choose that as well for our reporting, 12th to 19th. Let’s update this and it will give us the click data and the amount data and so on. So that’s the data that we want. 

The important thing now is to think about the schema again that we need to provide. So we need to have the actual date range here so each and every row needs to be a separate date. That’s something we need to provide as well in our reporting, so we can break our data down by the day actually. So now we get these different rows and that’s something I want to import into my spreadsheet. Now I could copy and paste that in but I can also export it as a .csv, again open it up in our Google Sheets account, we have that right here and here we have all the data that we need. So campaign name, all the data that we want to implement. Now we just need to put it into place in our template that we had available. So let’s look first of all at our primary keys which are the date keys. So here we have the dates, let’s copy those, put them in. The medium and source will always be the same, in our case, this is actually the source and our medium was CPC. And just go ahead and show that out automatically down here. Now we need to have the impressions, where can we find those? Right here. Now you see that there are some zeros in there because we didn’t run campaigns any more on the 17th, 18th, and 19th. So let’s put them in here. And then the cost data, this is the amount spent right here. And the actual ad clicks we have right here, you can take the unique clicks, put that in as well. So now we have that data properly formatted and put into place. Just be aware that if something doesn’t pan out Google Analytics will actually give us an error report so we can always go back and change that data around. Now let’s try this out. Let’s just export this as a .csv as well. And now go ahead into our admin section again into our data import, and into our Facebook. Nope, let’s go back, one step back, manage the uploads right here. Upload the file and choose the file, upload this data, now it’s uploading. It will take a while to validate it. And then it will tell you whether something failed or when correct, in our case it failed. What was the problem? Well the date was not correctly implemented so you get this error report which is quite useful. So let’s clean up these errors. First of all row two column three shouldn’t be negative. Let’s check that out, let’s go over here and this is the value and I see I have copied the wrong data, it should actually be impressions. So let’s copy that over here and go ahead and look at the second one, the date column is not properly formatted, you need to format it in this way. So let’s do that as well, let’s change the formatting here to a date but we need to have a custom date here which is actually something more like this without the separators here. Let’s apply this, so 20170512. Okay, so now it’s rightly formatted. This should also be something that is now solved and I don’t see any more errors so let’s try this out again, let’s export this and do this all again, let’s upload our file. It’s uploading, validating, and now it’s completed and we have status green. So this has worked as expected. So now we should have that data available in our acquisition reports on the campaigns and cost analysis. Unfortunately there is nothing because it actually takes 24 hours to upload that data and display it correctly in the account, join that data together with the processing engine of Google Analytics. 

Alright welcome back, not even a few hours later we now have the data available right here. So once we scroll down we now see our impressions, let’s click on that. We now see our campaign, our impressions, our costs, and so on. Now we didn’t set a campaign that’s why it’s on the not set. You could upload that as well if you want a breakdown by the campaign specifically. But now we see an impression count that we can obviously break down by day as well, clicks, costs, and so on so this all worked as expected. And this is how you can upload your cost data into Google Analytics, obviously not only with Facebook but also with Twitter data or Bing, everything that doesn’t connect directly with Google Analytics. 

Alright, so there you have it, this is how you can import your cost data into Google Analytics. A little bit manual, there are actually ways to doing this automatically and generating reports and then uploading them directly into your Google Analytics account, but this is the way you would do it if you would have the cost data ready after months for example, and then importing it directly into your Google Analytics account. If you have any questions then please leave them in the comments below. And if you like this video then give us a thumbs up and don’t forget to subscribe to our channel because we’ll bring you new videos every week. My name is Julian, ’til next time.


Master Data & Analytics with Measuremasters

Exclusive Courses & Workshops | Ongoing Troubleshooting | Support Resources, Tools & much more
Inline Feedbacks
View all comments

Blog Categories

Join 30,000+ marketers getting exclusive resources and our latest content!

now it's time to

Start measuring like a master

Itching to jump into the world of MeasureMasters? This is what you have to look forward to.