TOOL: Easily Upload Cost Data to Google Analytics

By /

April 9, 2013

UPDATE: Google Analytics has since updated the Cost Data import APIs, and added the ability to directly import CSV files directly in the interface. The old cost data import API used by this tool has now been deprecated.

As the avid users of AdWords know, Google Analytics has a great report that pulls in cost data from AdWords. If you have an ecommerce site or currency values assigned to your goal conversions, it’ll even calculate ROI.

Screen Shot 2013-04-09 at 12.15.57 AM

A while back, Google Analytics announced new support for importing cost data from other sources: think Bing Ads, Facebook advertising, etc. This is great! It puts all the power of those AdWords reports to work on your data from any kind of advertising.

The hard part is getting the data in. The data format is actually pretty easy (it’s just a CSV file). However, there’s no big “UPLOAD YOUR DATA HERE” button in Google Analytics.┬áThere’s an API for developers to import data, and a number of third-party tools that work with that API to import data from many sources. Ultimately, this is the way to go — having machines do the work on a schedule so you don’t have to. However, sometimes you just want to try things out and play with the data a bit, and if you don’t write code in Python or Java, there’s currently no easy way to do that.

Well, that is, until now. I made it just for you. Consider this your big UPLOAD YOUR DATA HERE button. UPDATE: Google Analytics has since updated the Cost Data import APIs, and added the ability to directly import CSV files directly in the interface.

Before you do this, you should follow the steps in the documentation to prepare. Briefly,

  1. Make sure you have campaigns tagged in Google Analytics.
  2. Format your cost data into a CSV file according to the specifications.
  3. Create a custom data source in Google Analytics in the Admin settings for your web property.

Screen Shot 2013-04-09 at 12.25.28 AM

Once you’ve done all that, you can use this manual uploader page to upload the data (one day’s worth per CSV file). Enter all the information, click the button, and presto!

A few pointers:

  • The Account and Web Property IDs can be found in the Admin interface in GA. The web property ID you see all over the place, and it looks something like “UA-12345-1″. The account ID is just the middle number (12345, in this case).
  • The Custom Data Source ID is found in the Custom Data Sources tab of the Admin interface, and is a long alphanumeric string. You create a separate custom data source for each different type of data you’re uploading (say, one for Bing Ads data, one for Facebook data).
  • The date must be in YYYY-MM-DD format.
  • There are a couple of additional settings under “Advanced Settings”. Generally these are OK if you’re just making one upload for each day. However, if your data file exceeds the size limit (5MB) you might have to break it into multiple pieces, in which case you can increment the “Append” value (1 for part 1, 2 for part 2, and so on). Or, if you make a mistake, you can overwrite a previous upload by using the same Append value and setting Reset to true.
  • You should see the upload appear pretty much immediately in the Admin interface. However, it may take some time for the data to be processed and appear in reports (the docs say “up to 12 hours”).

This is in very basic form right now: it doesn’t have any helpers to select from your list of accounts or web properties, and it does only very crude data validation. We’ll likely make it better over time. Feel free to leave comments if you find bugs or have suggested improvements. We’ve tested this reasonably thoroughly, but it’s free and there are no guarantees it will work for you, yada yada yada.

Note that this accesses your Google Analytics account through the OAuth protocol, which means it has access to whatever you have access to, but it connect you directly with Google Analytics. Your login, password, and data never touches our servers.

This is all made possible by the new file reader APIs in HTML5 (which your browser must support to use this), the Google Javascript API library, the authorization handlers written by Nick Mihailovski at Google used in the Hello Analytics tutorial, the letter G, and the color orange.

Jonathan Weber is our Data Evangelist, focusing on bringing the strategic value of data analysis to our customers. He spreads the principles of analytics through our training seminars and is currently writing a book on Google Analytics & Tag Manager. Before he caught the analytics bug, he worked in information architecture. Away from the computer you can find him as a flower farmer and plant geek.

  • http://strategydefined.com Neil Krishnan

    Awesome stuff Jonathan – this takes the automated google spreadsheet to the next level. Looking forward to using it.

  • Mary Kay Lofurno

    Nice, thanks, Mary Kay

  • http://bySmits Dion

    Looks like a nice tool. Tried to use it today and used the most simple csv file with only one line of data. But there was an error message that unfortunately doesn’t show what might be wrong: “There was a problem uploading the file.” Is there a little bit of support?

    • Jonathan Weber

      Hi Dion — as I mentioned, the tool is very bare-bones at the moment and doesn’t show specific errors. Here’s a list of common things to check: (1) the CSV needs a header row and must contain data for ga:source, ga:medium, and at least one metric, and (2) the account/web property must be one that you have administrative access to. If you’ve checked both of those, send me the CSV at weber(AT)www.lunametrics.com and I will test it out for you.

  • FOREX Programming

    Great idea Google!

    Is it me or is this a great way for google to get cost data from its competitors (thanks to the people who upload the data), and use that data to dominate/squeeze-out competitors?

  • Alisa Meggison

    Dion – I have recently used this tool. I exported BING data for a client of mine for the whole month. I included a DATE field, but this tool didn’t work with it included. So I took the original file, broke it down into individual days, I deleted the date column and I saved the file as a CSV formatted for MS-DOS.

    This tool is for single day uploads, not multiple days.

    Hope that helps.
    Alisa

  • http://www.t4g.com Ian

    Really looking forward to using this! However, I have a bunch of client’s GA accounts under my login. Is see that Step 1 is to authorize LunaMetrics permission to ‘View and manage your Google Analytics data'; will all of the admins of the respective accounts receive an email advising this? I just need to know so I can set/manage expectations accordingly.

  • http://www.lunametrics.com/ Jonathan Weber

    Ian — No, there are no notifications. You can see apps you’ve authorized to access your data (and revoke access should you ever want to) at https://accounts.google.com/b/0/IssuedAuthSubTokens (when you’re logged into your Google account).

  • http://ronan-chardonneau.fr Ronan

    Finally someone who understands exactly what non techy guy need in order to work a little bit on Google Analytics.
    Thank you so much I was waiting for this big button since a long time :)

  • http://www.famtivity.com Rasim

    Hi,
    I’m using the following CSV and getting upload error. I’ve tried multiple changes with a one line csv to test also:

    ga:source,ga:medium,ga:campaign,ga:adCost,ga:adClicks,ga:impressions
    Facebook,cpc,Carlsbad25mi,4.07,4,973
    Facebook,cpc,PromoFam092313,2.53,3,69
    Facebook,cpc,WC25mi,646.62,1015,129784
    Facebook,cpc,WCMob,240,457,24749
    Facebook,cpc,StToBlogWC50mi,320,712,49557

  • http://TaCerto.com Mimi

    Hi Jonahtan,
    Thanks for sharing this tool! Do you have any recommendations for tools that automate this data upload? Would love to see a follow-up post!
    Cheers

  • http://ahennie.no Andreas H

    I was able to get this working by using this file example: http://cl.ly/2M1P0V3z1D0j
    Important to just upload one day at the time.

Contact Us.

LunaMetrics

24 S. 18th Street, Suite 100,
Pittsburgh, PA 15203

Follow Us

1.877.220.LUNA

1.412.381.5500

getinfo@lunametrics.com

Questions?
We'll get back to you
in ONE business day.