{"id":232,"date":"2016-10-02T15:18:16","date_gmt":"2016-10-02T11:18:16","guid":{"rendered":"https:\/\/optimizationup.com\/?p=232"},"modified":"2016-10-02T15:18:16","modified_gmt":"2016-10-02T11:18:16","slug":"import-cost-google-analytics-automatically","status":"publish","type":"post","link":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/","title":{"rendered":"Automatically Import Cost Data into Google Analytics"},"content":{"rendered":"<p><span style=\"color: #99cc00;\"><a style=\"color: #99cc00;\" href=\"https:\/\/optimizationup.com\/tag\/analytics\/\">Google Analytics<\/a><\/span> allows importing\u00a0cost data for non-Google campaigns where you can monitor performance across all your channels in one place.\u00a0In this article, we will learn how to upload the cost data for your Facebook and Bing campaigns into\u00a0Google Analytics <strong>automatically<\/strong>\u00a0using Google apps script. <strong>Google apps script<\/strong>\u00a0is a scripting language based on JavaScript that lets you do new and cool things with Google Apps like Docs, Sheets, and Forms. There&#8217;s nothing to install \u2014 we give you a code editor right in your browser, and your scripts run on Google&#8217;s servers.<\/p>\n<p>Good to mention before we start that we&#8217;ll review only the push part automation to Google Analytics API, this means that you need also to automate pulling the data from whatever data source (Facebook, Bing) you are going to submit to GA. There are many spreadsheet add-ons that allow you to get your metrics from various sources like Facebook and Bing into one spreadsheet, moreover, you can schedule automatic daily refresh for your data and this is what you actually need to apply this method. So, let&#8217;s get down to business:-<\/p>\n<h5>1- Create the Data Set through GA<\/h5>\n<p>Go to the Admin panel of the GA account that we&#8217;re trying to upload the data to. Under the &#8220;<strong>Property&#8221;<\/strong> column, we\u2019re going to select <strong>&#8220;Data Import&#8221;<\/strong>\u00a0and follow the steps below:-<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-235\" src=\"https:\/\/optimizationup.com\/wp-content\/uploads\/2016\/10\/Data-import-Google-Analytics-300x186.png\" alt=\"data-import-google-analytics\" width=\"545\" height=\"338\" \/><\/p>\n<p>Click <strong>&#8220;+New Data Set&#8221;<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-236\" src=\"https:\/\/optimizationup.com\/wp-content\/uploads\/2016\/10\/Data-Set-Cost-import-GA-300x98.png\" alt=\"data-set-cost-import-ga\" width=\"533\" height=\"174\" \/><\/p>\n<p>Select <strong>&#8220;Cost Import&#8221;<\/strong> and\u00a0Select\u00a0one or more views to associate with this Data Set.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-243\" src=\"https:\/\/optimizationup.com\/wp-content\/uploads\/2016\/10\/Import-Cost-Automatically-GA-300x169.png\" alt=\"import-cost-automatically-ga\" width=\"563\" height=\"317\" \/><\/p>\n<p>Define the Data Set\u00a0schema to include dimensions and metrics, in this example, we only picked cost as a metric and source\/medium &amp; campaign as a dimension. You can add clicks and impressions if you\u00a0need.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-233\" src=\"https:\/\/optimizationup.com\/wp-content\/uploads\/2016\/10\/Cost-Import-Google-Analytics-Data-schema-300x213.png\" alt=\"cost-import-google-analytics-data-schema\" width=\"589\" height=\"418\" \/><\/p>\n<p>Finally, save and then click\u00a0<strong>&#8220;Get Custom Data Source ID (for API Users)<\/strong>&#8220;, copy the ID, will be using it later on.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-234\" src=\"https:\/\/optimizationup.com\/wp-content\/uploads\/2016\/10\/Cost-Import-Google-Analytics-300x153.png\" alt=\"cost-import-google-analytics\" width=\"608\" height=\"310\" \/><\/p>\n<h5>2- Format the data per Google Analytics requirements<\/h5>\n<p>As mention before, in this article we only cover how to push the cost data automatically to GA, you need also a connector or a spreadsheet add-on to pull the data from Facebook or Bing automatically. After you have the data you want to import to <span style=\"color: #99cc00;\"><a style=\"color: #99cc00;\" href=\"https:\/\/optimizationup.com\/tag\/analytics\/\">GA<\/a><\/span> in a Google spreadsheet, you need to reformat this data using\u00a0<strong>Google schema<\/strong>,\u00a0copy and replace the header title with the respective metric\/dimension below:-<\/p>\n<p><code>ga:date,ga:medium,ga:source,ga:adCost,ga:campaign<\/code><\/p>\n<p>To format the data extracted from Facebook and Bing, you can use the formula below:-<\/p>\n<p><code><span class=\" default-formula-text-color\" dir=\"auto\">=<\/span><span class=\" default-formula-text-color\" dir=\"auto\">if<\/span><span class=\" default-formula-text-color\" dir=\"auto\">(<\/span><span dir=\"auto\">Source!$A$2<\/span><span class=\" default-formula-text-color\" dir=\"auto\">=<\/span><span class=\" string \" dir=\"auto\">\"\"<\/span><span class=\" default-formula-text-color\" dir=\"auto\">,<\/span><span dir=\"auto\">Source!G1<\/span><span class=\" default-formula-text-color\" dir=\"auto\">,<\/span><span class=\" default-formula-text-color\" dir=\"auto\">(<\/span><span class=\" default-formula-text-color\" dir=\"auto\">left<\/span><span class=\" default-formula-text-color\" dir=\"auto\">(<\/span><span dir=\"auto\">Source!$A$2<\/span><span class=\" default-formula-text-color\" dir=\"auto\">,<\/span><span class=\"number\" dir=\"auto\">4<\/span><span class=\" default-formula-text-color\" dir=\"auto\">)<\/span><span class=\" default-formula-text-color\" dir=\"auto\">&amp;<\/span><span class=\" default-formula-text-color\" dir=\"auto\">mid<\/span><span class=\" default-formula-text-color\" dir=\"auto\">(<\/span><span dir=\"auto\">Source!$A$2<\/span><span class=\" default-formula-text-color\" dir=\"auto\">,<\/span><span class=\"number\" dir=\"auto\">6<\/span><span class=\" default-formula-text-color\" dir=\"auto\">,<\/span><span class=\"number\" dir=\"auto\">2<\/span><span class=\" default-formula-text-color\" dir=\"auto\">)<\/span><span class=\" default-formula-text-color\" dir=\"auto\">&amp;<\/span><span class=\" default-formula-text-color\" dir=\"auto\">right<\/span><span class=\" default-formula-text-color\" dir=\"auto\">(<\/span><span dir=\"auto\">Source!$A$2<\/span><span class=\" default-formula-text-color\" dir=\"auto\">,<\/span><span class=\"number\" dir=\"auto\">2<\/span><span class=\" default-formula-text-color\" dir=\"auto\">)<\/span><span class=\" default-formula-text-color\" dir=\"auto\">)<\/span><span class=\" default-formula-text-color\" dir=\"auto\">)<\/span><\/code><\/p>\n<h5><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-247\" src=\"https:\/\/optimizationup.com\/wp-content\/uploads\/2016\/10\/format-google-schema-300x76.png\" alt=\"format-google-schema cost data\" width=\"572\" height=\"145\" \/><\/h5>\n<h5><\/h5>\n<h5>3- Connect Google app script to your spreadsheet.<\/h5>\n<p>Once you have the data correctly formatted, it&#8217;s time to connect Google app script to your spreadsheet. Click tools then <strong>&#8220;Script Editor&#8221;<\/strong>:-<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-242\" src=\"https:\/\/optimizationup.com\/wp-content\/uploads\/2016\/10\/Google-Spreadsheet-Google-Analytics-Cost-import-300x132.png\" alt=\"google-spreadsheet-google-analytics-cost-import\" width=\"541\" height=\"238\" \/><\/p>\n<p>Now, the script editor is open:-<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-240\" src=\"https:\/\/optimizationup.com\/wp-content\/uploads\/2016\/10\/Google-app-scirp-ga-cost-upload-300x168.png\" alt=\"google-app-scirp-ga-cost-upload\" width=\"570\" height=\"319\" \/><\/p>\n<p>Delete any code in the script editor and paste in the code below<\/p>\n<pre><code><span style=\"font-size: 12pt;\"> function uploadData() {<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> var accountId = \"<span style=\"color: #ff0000;\">xxxxxxx<\/span>\";<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> var webPropertyId = \"<span style=\"color: #ff0000;\">UA-25xxxxx<\/span>\";<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> var customDataSourceId = \"<span style=\"color: #ff0000;\">CAuCSza1SXCifs79teXIEw<\/span>\";<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> var maxRows = ss.getLastRow();<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> var maxColumns = ss.getLastColumn();<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> var data = [];<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> for (var i = 1; i &lt; maxRows;i++) {<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> data.push(ss.getRange([i], 1,1, maxColumns).getValues());<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> }<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> var newData = data.join(\"\\n\");<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> var blobData = Utilities.newBlob(newData, \"application\/octet-stream\", \"GA import data\");<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> try {<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> var upload = Analytics.Management.Uploads.uploadData(accountId, webPropertyId, customDataSourceId, blobData);<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> SpreadsheetApp.getUi().alert(\"Uploading: OK\");<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> }<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> catch(err) {<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> SpreadsheetApp.getUi().alert(\"Cannot upload: Failed\");<\/span><\/code>\n<code><span style=\"font-size: 12pt;\"> }<\/span><\/code>\n\n<code><span style=\"font-size: 12pt;\">}<\/span><\/code>\n<\/pre>\n<p>Please note that you need to replace what&#8217;s in red with your relevant data, the account id, the property\u00a0id and finally the API id we generated in step 1 (above).Then,\u00a0click &#8220;resource&#8221; and choose &#8220;Advanced Google Services&#8221;:-<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-250\" src=\"https:\/\/optimizationup.com\/wp-content\/uploads\/2016\/10\/GA-API-Google-App-Script-300x208.png\" alt=\"import cost data\" width=\"534\" height=\"370\" \/><\/p>\n<p>Turn on the <strong><span style=\"color: #000000;\"><a style=\"color: #000000;\" href=\"https:\/\/optimizationup.com\/tag\/analytics\/\">Google Analytics<\/a><\/span> API<\/strong>:-<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-239\" src=\"https:\/\/optimizationup.com\/wp-content\/uploads\/2016\/10\/Google-Analytics-Api-300x176.png\" alt=\"google-analytics-api\" width=\"606\" height=\"356\" \/><\/p>\n<p>Finally, try to run your script:-<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-244\" src=\"https:\/\/optimizationup.com\/wp-content\/uploads\/2016\/10\/Scirpt-upload-cost-ga-automatically-300x154.png\" alt=\"scirpt-upload-cost-ga-automatically\" width=\"608\" height=\"312\" \/><\/p>\n<p>A small window will pop up asking you to authorize permission to access your Google drive and Google Analytics. Once you do so, the data will get uploaded successfully to Google analytics as long as it&#8217;s in the correct format:-<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-238\" src=\"https:\/\/optimizationup.com\/wp-content\/uploads\/2016\/10\/Google-analytics-api-script-300x136.png\" alt=\"google-analytics-api-script\" width=\"588\" height=\"267\" \/><\/p>\n<p>Now, you can schedule an upload to happen on an hourly, daily or weekly basis, Google will run the script and import the data exists\u00a0your spreadsheet through their management API. On the other side, you should also have a pull schedule to get your data from Facebook and Bing. Let&#8217;s say, you will automate a trigger through \u00a0your spreadsheet add-on to refresh your data at midnight, in this case, it&#8217;s recommended to schedule Google apps script to run at least one hour after to push the data to GA.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-241\" src=\"https:\/\/optimizationup.com\/wp-content\/uploads\/2016\/10\/Google-App-scirpt-Google-Analytics-Cost-300x145.png\" alt=\"google-app-scirpt-google-analytics-cost\" width=\"583\" height=\"282\" \/><\/p>\n<p>Once the cost, clicks, and impressions data have been imported and have finished syncing with the existing traffic data at the source\/medium, campaign, and keyword levels. You have the ability to see this data in two important places within GA. Firstly, the &#8220;Cost Analysis&#8221; section of &#8220;Acquisition&#8221; under the &#8220;Campaigns&#8221; parent tab displays campaign and e-commerce information similar to what you&#8217;d see under the &#8220;<span style=\"color: #99cc00;\"><a style=\"color: #99cc00;\" href=\"https:\/\/optimizationup.com\/tag\/adwords\/\">AdWords<\/a><\/span>&#8221; section of &#8220;Acquisition&#8221;. Looking forward to your comments below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Google Analytics allows importing\u00a0cost data for non-Google campaigns where you can monitor performance across all your channels in one place.\u00a0In this article, we will learn how to upload the cost data for your Facebook and Bing campaigns into\u00a0Google Analytics automatically\u00a0using Google apps script. Google apps script\u00a0is a scripting language based on JavaScript that lets you&#8230;<\/p>\n<p><a class=\"read-more\" href=\"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":252,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37],"tags":[41],"class_list":["post-232","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-measure","tag-analytics"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Automatically Import Cost Data into Google Analytics | Optimization Up<\/title>\n<meta name=\"description\" content=\"Learn how to automatically import cost data from Facebook, Bing and other sources into Google Analytics using Google apps script.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Automatically Import Cost Data into Google Analytics | Optimization Up\" \/>\n<meta property=\"og:description\" content=\"Learn how to automatically import cost data from Facebook, Bing and other sources into Google Analytics using Google apps script.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/\" \/>\n<meta property=\"og:site_name\" content=\"Optimization Up\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/A7med.3lii\" \/>\n<meta property=\"article:published_time\" content=\"2016-10-02T11:18:16+00:00\" \/>\n<meta name=\"author\" content=\"Ahmed Ali\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@A7med_3ly\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ahmed Ali\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/optimizationup.com\\\/import-cost-google-analytics-automatically\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/optimizationup.com\\\/import-cost-google-analytics-automatically\\\/\"},\"author\":{\"name\":\"Ahmed Ali\",\"@id\":\"https:\\\/\\\/optimizationup.com\\\/#\\\/schema\\\/person\\\/75b8aaa058bc4d0630cc7e138840f768\"},\"headline\":\"Automatically Import Cost Data into Google Analytics\",\"datePublished\":\"2016-10-02T11:18:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/optimizationup.com\\\/import-cost-google-analytics-automatically\\\/\"},\"wordCount\":730,\"commentCount\":22,\"image\":{\"@id\":\"https:\\\/\\\/optimizationup.com\\\/import-cost-google-analytics-automatically\\\/#primaryimage\"},\"thumbnailUrl\":\"\",\"keywords\":[\"Analytics\"],\"articleSection\":[\"Measure\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/optimizationup.com\\\/import-cost-google-analytics-automatically\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/optimizationup.com\\\/import-cost-google-analytics-automatically\\\/\",\"url\":\"https:\\\/\\\/optimizationup.com\\\/import-cost-google-analytics-automatically\\\/\",\"name\":\"Automatically Import Cost Data into Google Analytics | Optimization Up\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/optimizationup.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/optimizationup.com\\\/import-cost-google-analytics-automatically\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/optimizationup.com\\\/import-cost-google-analytics-automatically\\\/#primaryimage\"},\"thumbnailUrl\":\"\",\"datePublished\":\"2016-10-02T11:18:16+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/optimizationup.com\\\/#\\\/schema\\\/person\\\/75b8aaa058bc4d0630cc7e138840f768\"},\"description\":\"Learn how to automatically import cost data from Facebook, Bing and other sources into Google Analytics using Google apps script.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/optimizationup.com\\\/import-cost-google-analytics-automatically\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/optimizationup.com\\\/import-cost-google-analytics-automatically\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/optimizationup.com\\\/import-cost-google-analytics-automatically\\\/#primaryimage\",\"url\":\"\",\"contentUrl\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/optimizationup.com\\\/import-cost-google-analytics-automatically\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/optimizationup.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automatically Import Cost Data into Google Analytics\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/optimizationup.com\\\/#website\",\"url\":\"https:\\\/\\\/optimizationup.com\\\/\",\"name\":\"Optimization Up\",\"description\":\"Advanced Optimization &amp; Analytics Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/optimizationup.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/optimizationup.com\\\/#\\\/schema\\\/person\\\/75b8aaa058bc4d0630cc7e138840f768\",\"name\":\"Ahmed Ali\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/68727300a58d1891a3dda2e17e66e7ebd42c80226d3006db77b4814bc14d4d43?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/68727300a58d1891a3dda2e17e66e7ebd42c80226d3006db77b4814bc14d4d43?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/68727300a58d1891a3dda2e17e66e7ebd42c80226d3006db77b4814bc14d4d43?s=96&d=mm&r=g\",\"caption\":\"Ahmed Ali\"},\"description\":\"Entrepreneur focused on building MarTech products that bridge the gap between marketing and technology. Check out my latest products Markifact,\u00a0 Marketing Auditor &amp; GA4 Auditor - discover all my products here.\",\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/A7med.3lii\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/a7med-ali\\\/\",\"https:\\\/\\\/x.com\\\/A7med_3ly\"],\"url\":\"https:\\\/\\\/optimizationup.com\\\/author\\\/a7med\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Automatically Import Cost Data into Google Analytics | Optimization Up","description":"Learn how to automatically import cost data from Facebook, Bing and other sources into Google Analytics using Google apps script.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/","og_locale":"en_US","og_type":"article","og_title":"Automatically Import Cost Data into Google Analytics | Optimization Up","og_description":"Learn how to automatically import cost data from Facebook, Bing and other sources into Google Analytics using Google apps script.","og_url":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/","og_site_name":"Optimization Up","article_author":"https:\/\/www.facebook.com\/A7med.3lii","article_published_time":"2016-10-02T11:18:16+00:00","author":"Ahmed Ali","twitter_card":"summary_large_image","twitter_creator":"@A7med_3ly","twitter_misc":{"Written by":"Ahmed Ali","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/#article","isPartOf":{"@id":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/"},"author":{"name":"Ahmed Ali","@id":"https:\/\/optimizationup.com\/#\/schema\/person\/75b8aaa058bc4d0630cc7e138840f768"},"headline":"Automatically Import Cost Data into Google Analytics","datePublished":"2016-10-02T11:18:16+00:00","mainEntityOfPage":{"@id":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/"},"wordCount":730,"commentCount":22,"image":{"@id":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/#primaryimage"},"thumbnailUrl":"","keywords":["Analytics"],"articleSection":["Measure"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/","url":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/","name":"Automatically Import Cost Data into Google Analytics | Optimization Up","isPartOf":{"@id":"https:\/\/optimizationup.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/#primaryimage"},"image":{"@id":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/#primaryimage"},"thumbnailUrl":"","datePublished":"2016-10-02T11:18:16+00:00","author":{"@id":"https:\/\/optimizationup.com\/#\/schema\/person\/75b8aaa058bc4d0630cc7e138840f768"},"description":"Learn how to automatically import cost data from Facebook, Bing and other sources into Google Analytics using Google apps script.","breadcrumb":{"@id":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/#primaryimage","url":"","contentUrl":""},{"@type":"BreadcrumbList","@id":"https:\/\/optimizationup.com\/import-cost-google-analytics-automatically\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/optimizationup.com\/"},{"@type":"ListItem","position":2,"name":"Automatically Import Cost Data into Google Analytics"}]},{"@type":"WebSite","@id":"https:\/\/optimizationup.com\/#website","url":"https:\/\/optimizationup.com\/","name":"Optimization Up","description":"Advanced Optimization &amp; Analytics Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/optimizationup.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/optimizationup.com\/#\/schema\/person\/75b8aaa058bc4d0630cc7e138840f768","name":"Ahmed Ali","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/68727300a58d1891a3dda2e17e66e7ebd42c80226d3006db77b4814bc14d4d43?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/68727300a58d1891a3dda2e17e66e7ebd42c80226d3006db77b4814bc14d4d43?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/68727300a58d1891a3dda2e17e66e7ebd42c80226d3006db77b4814bc14d4d43?s=96&d=mm&r=g","caption":"Ahmed Ali"},"description":"Entrepreneur focused on building MarTech products that bridge the gap between marketing and technology. Check out my latest products Markifact,\u00a0 Marketing Auditor &amp; GA4 Auditor - discover all my products here.","sameAs":["https:\/\/www.facebook.com\/A7med.3lii","https:\/\/www.linkedin.com\/in\/a7med-ali\/","https:\/\/x.com\/A7med_3ly"],"url":"https:\/\/optimizationup.com\/author\/a7med\/"}]}},"_links":{"self":[{"href":"https:\/\/optimizationup.com\/wp-json\/wp\/v2\/posts\/232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/optimizationup.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/optimizationup.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/optimizationup.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/optimizationup.com\/wp-json\/wp\/v2\/comments?post=232"}],"version-history":[{"count":0,"href":"https:\/\/optimizationup.com\/wp-json\/wp\/v2\/posts\/232\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/optimizationup.com\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/optimizationup.com\/wp-json\/wp\/v2\/media?parent=232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/optimizationup.com\/wp-json\/wp\/v2\/categories?post=232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/optimizationup.com\/wp-json\/wp\/v2\/tags?post=232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}