{"id":170109,"date":"2013-02-21T13:41:03","date_gmt":"2013-02-21T09:41:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=170109"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=170109","title":{"rendered":"<span class=\"post_title\">\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0442\u0440\u0438\u043a \u0434\u043b\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e GoogleDocs + Google Script<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0427\u0438\u043d\u0433\u0438\u0441, \u044f \u0441\u043e\u043e\u0441\u043d\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 <a href=\"http:\/\/worksection.com\">Worksection.com<\/a><\/p>\n<p>  \u041c\u044b \u0443 \u0441\u0435\u0431\u044f \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c \u0440\u044f\u0434 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a. \u041f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u044f, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0438, \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438, \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435, \u043e\u0442\u0442\u043e\u043a \u0438 \u0442\u0434. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0432\u0435\u0434\u0435\u043c \u0432 \u0441\u0432\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432 Google Docs. \u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043c\u0435\u0442\u0440\u0438\u043a \u2014 \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u0438\u0441\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0438\u0437 Google Analytics \u0438 \u0438\u0437 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041f\u043e\u0442\u0440\u0430\u0442\u0438\u0432 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043c\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u044d\u0442\u043e\u0442 \u0441\u0431\u043e\u0440. <\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0417\u0430 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0441\u0432\u043e\u0434\u043d\u043e\u0439 Excel \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0440\u0430\u043b\u0438 \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c <a href=\"http:\/\/www.quora.com\/Matthew-Carroll\">Matthew Carroll<\/a> <a href=\"http:\/\/retail-analytics.quora.com\/Forecasting-Revenue-Expenses-for-an-E-Commerce-Startup-Introduction-Overview\">\u0434\u043b\u044f \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u043e\u0432<\/a>. <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/i.imgur.com\/U2zYjz9.png\" alt=\"image\"\/><\/p>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 Google Docs \u0432\u0431\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e. \u0412 \u0438\u0442\u043e\u0433\u0435, \u044f \u0442\u0430\u043a \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u043b \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0441\u044f\u0446 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 <a href=\"http:\/\/goo.gl\/otgFB\">\u043e\u0431\u0437\u043e\u0440 <\/a>\u043f\u0440\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438<\/p>\n<p>  \u041d\u0430 \u0437\u0430\u043f\u0430\u0434\u0435 \u0442\u0430\u043a\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0443\u0436\u0435 \u043c\u043d\u043e\u0433\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <a href=\"http:\/\/DucksBoard.com\">DucksBoard<\/a><br \/>  <a href=\"http:\/\/Totango.com\">Totango<\/a><br \/>  <a href=\"http:\/\/Kissmetrics.com\">Kissmetrics<\/a><\/p>\n<p>  \u041c\u043d\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u041d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0431\u044b\u043b\u043e \u043c\u043d\u043e\u0433\u043e, \u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0431\u044b\u043b\u0430 \u0443\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0438 \u201c\u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u201d, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0430\u043c\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 Google Docs \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/developers.google.com\/apps-script\/\">Google Script<\/a><\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u043e\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0431\u044b\u043b\u0430:<\/p>\n<ul>\n<li>\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 Google Analytics \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u0435\u0441\u044f\u0446<\/li>\n<li>\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u0435\u0441\u044f\u0446<\/li>\n<li>\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u0441 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c <\/li>\n<\/ul>\n<p>  \u041f\u043e\u0442\u0440\u0430\u0442\u0438\u0432 \u043f\u043e\u043b\u0434\u043d\u044f \u043d\u0430 \u0440\u0430\u0437\u0431\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0430\u0448\u0438\u0445 \u043c\u0435\u0442\u0440\u0438\u043a \u0432 \u0432\u0430\u0448 Excel \u0444\u0430\u0439\u043b<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 <a href=\"https:\/\/script.google.com\/\">script.google.com\/<\/a> ( \u0443 \u0432\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u0447\u0435\u0442\u043a\u0430 Google )<\/p>\n<p>  2. \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434  <\/p>\n<pre><code class=\"javascript\">function setNewMetrics() {      \/\/ \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Excel \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435  \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/   var ss = SpreadsheetApp.openById(&quot;0AjAbTD8WcDQMdC1MWmtUR3VlUWJTSHIzQ0dsSS1HSGc&quot;); \/\/ \u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0445\u0435\u0448 \u0432\u0430\u0448\u0435\u0439 Excel \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c !!!!!!!!!!!!!!!!!!!!!   SpreadsheetApp.setActiveSpreadsheet(ss);   var sheet= SpreadsheetApp.setActiveSheet(ss.getSheets()[1]);  \/\/ \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443(sheet) \u0432 Excel    \u0444\u0430\u0439\u043b\u0435 !!!!!!!!!!!!!!   Logger.log(&quot;\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b = &quot;+sheet.getName()); \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 - \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 &quot;\u043c\u0435\u043d\u044e Run-&gt; setNewMetrics&quot;   - \u0436\u043c\u0435\u043c CNTRL + ENTER - \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043b\u043e\u0433      var sCol = new Array(); \/\/ \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432\u0441\u0442\u0430\u0432\u0438\u043c \u0432 Excel     \/\/ \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u0442\u0443   var d = new Date();   var monthNames = [ &quot;January&quot;, &quot;February&quot;, &quot;March&quot;, &quot;April&quot;, &quot;May&quot;, &quot;June&quot;,&quot;July&quot;, &quot;August&quot;, &quot;September&quot;, &quot;October&quot;, &quot;November&quot;, &quot;December&quot; ];   var cMonth= d.getMonth(); var cYear = d.getFullYear();    cMonth= (cMonth + 12 - 1) % 12  \/\/ \u0438\u0449\u0435\u043c \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u043c\u0435\u0441\u044f\u0446 ( \u0435\u0441\u043b\u0438 \u043d\u0430\u0434\u043e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0437\u0430 2 \u043c\u0435\u0441\u044f\u0446\u0430 \u043d\u0430\u0437\u0430\u0434 &quot;1&quot; \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430  &quot;2&quot; )   if ( (cMonth-1) &gt; 0 ) cYear--; \/\/ \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0433\u043e\u0434, \u0435\u0441\u043b\u0438 \u044f\u043d\u0432\u0430\u0440\u044c     var cMonth_str = monthNames[cMonth];   sCol[1] = cMonth_str+&quot; &quot;+cYear;  \/\/ \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438  \u043c\u0435\u0441\u044f\u0446         \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435  \u0438\u0437 GA \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/   \/\/\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 API GA \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e &quot;\u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c&quot; API, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f https:\/\/developers.google.com\/analytics\/solutions\/articles\/reporting-apps-script#registration    \/\/ \u043f\u043e\u0441\u043b\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 getProfile() \u043d\u0438\u0436\u0435       var sProfile=getProfile();   \/\/ \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u043f\u0440\u043e\u0444\u0430\u0439\u043b GA,  \u0444\u0443\u043d\u043a\u0446\u0438\u044e  \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0434 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c, \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0438\u0436\u0435   !!!!!!   var oGA = getReportDataForProfile(sProfile).getTotalsForAllResults(); \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438  !!!!!!   sCol[3] = oGA[&quot;ga:visits&quot;];  \/\/ \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 visits   sCol[12] = oGA[&quot;ga:goalCompletionsAll&quot;]\/oGA[&quot;ga:visits&quot;]; \/\/ \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044e Visit-&gt; Trial  Logger.log( &quot;\u0414\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 GA -&gt; &quot;+sCol[12]); \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 GA \u0434\u0430\u043d\u043d\u044b\u0435           \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c JSON \u0444\u0430\u0439\u043b \u0441 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0437\u0430\u0431\u0438\u0440\u0430\u044e \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430  \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/   \/\/ \u041d\u0430\u0434\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c  \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0432\u0430\u0448\u0435\u0433\u043e JSON \u0444\u0430\u0439\u043b\u0430    var opts = {&quot;contentType&quot;:&quot;multipart\/form-data&quot;, &quot;method&quot; : &quot;post&quot;,}   var response = UrlFetchApp.fetch(&quot;http:\/\/YOURSITE.com\/8IiXcnPkEi3W.json&quot;, opts);  \/\/ \u044f \u043f\u043e\u043b\u0443\u0447\u0430\u044e \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 JSON \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435   \/*     {&quot;24&quot;:{&quot;date&quot;:&quot;February 2011&quot;,&quot;new_paid&quot;:&quot;360&quot;,&quot;churn&quot;:2}, &quot;23&quot;:{&quot;date&quot;:&quot;March 2011&quot;,&quot;new_paid&quot;:&quot;38&quot;,&quot;churn&quot;:2}}     *\/   var jsondata = response.getContentText();    jsondata = JSON.parse(jsondata); \/\/ \u043f\u0430\u0440\u0441\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e jsondata     for (var month in jsondata) {     \/\/Logger.log(&quot;==&gt;&quot;+month+jsondata[month] + jsondata[month][&quot;date&quot;]);     if ( (cMonth_str+&quot; &quot;+ cYear) === jsondata[month][&quot;date&quot;] ) {         \/\/ \u043d\u0430\u0448\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u043c\u0435\u0441\u044f\u0446 - \u0432\u043d\u043e\u0441\u0438\u043c \u0438\u0445    !!!!!!!!!!!!!!       sCol[7] = jsondata[month][&quot;new&quot;];       sCol[8] = jsondata[month][&quot;lost&quot;];       sCol[22] = jsondata[month][&quot;churn&quot;]+&quot;%&quot;;       sCol[23] = jsondata[month][&quot;churn_paid&quot;]+&quot;%&quot;;       sCol[25] = jsondata[month][&quot;ltv&quot;];     }   }         \/\/ \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 Excel   \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/  \/\/ \u044f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043a\u043e\u043b\u043e\u043d\u043a\u0443 Excel \u0444\u0430\u0439\u043b\u0430.  \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043a\u043e\u043b\u043e\u043d\u043a\u0443   var sLastcolumn = sheet.getLastColumn()+1;   var oRange = sheet.getRange(1,sLastcolumn )  ;   for (var i=1; i&lt;(sCol.length+1); i++) {     if (sCol[i]) oRange.setValue(sCol[i]); \/\/ \u0437\u0430\u043f\u0438\u0441\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u044f\u0447\u0435\u0439\u043a\u0443      oRange = oRange.offset(1, 0, 1, 1); \/\/ \u0441\u043c\u0435\u0449\u0430\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0432\u043d\u0438\u0437   }   \/\/ \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442 \u0438\u0437  \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0438    var oRange1 =sheet.getRange(1,sLastcolumn-1,100,1) \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0438 \u0441\u0442\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0440\u044f\u0434\u043e\u0432   oRange1.copyFormatToRange(sheet,sLastcolumn,sLastcolumn,1,100);\/\/ \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442      }    \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u0438\u0437 GA(google analytics)  function getProfile() {     var accounts = Analytics.Management.Accounts.list();    if (accounts.getItems()) {     var firstAccountId = accounts.getItems()[1].getId(); \/\/ \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0438\u0437 \u0433\u0443\u0433\u043b \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438  ( \u043d\u043e\u043c\u0435\u0440 &quot;1&quot; \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 &quot;\u0441\u0432\u043e\u0439&quot; )!!!!!      \/\/Logger.log(accounts.getItems()[1].getName());  \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     var webProperties = Analytics.Management.Webproperties.list(firstAccountId);         if (webProperties.getItems()) {       var firstWebPropertyId = webProperties.getItems()[10].getId();\/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u043f\u0440\u043e\u0444\u0430\u0439\u043b \u211610 ( \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043b \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u043e\u043c ) )  !!!!!!!       \/\/Logger.log(webProperties.getItems()[10]);\/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u0440\u043e\u0444\u0430\u0439\u043b       var profiles = Analytics.Management.Profiles.list(firstAccountId, firstWebPropertyId);        if (profiles.getItems()) {         var Profile = profiles.getItems()[0];         return Profile;       } else {         throw new Error('No profiles found.');       }     } else {       throw new Error('No webproperties found.');     }   } else {     throw new Error('No accounts found.');   } }   function getReportDataForProfile(firstProfile) {   \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 Google Analytics \u043f\u043e \u0434\u0430\u043d\u043d\u044b\u043c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u043c\u0435\u0441\u044f\u0446    var profileId = firstProfile.getId();   var tableId = 'ga:' + profileId;   var sLastMonthRange = getLastMonth(1);   \/\/       var optArgs = {    \/* 'dimensions': 'ga:keyword',              \/\/ Comma separated list of dimensions.     'sort': '-ga:visits,ga:keyword',         \/\/ Sort by visits descending, then keyword.     'segment': 'dynamic::ga:isMobile==Yes',  \/\/ Process only mobile traffic.     'filters': 'ga:source==google',          \/\/ Display only google traffic.     'start-index': '1',     'max-results': '250'                     \/\/ Display the first 250 results.*\/   };    \/\/ Make a request to the API.   var results = Analytics.Data.Ga.get(       tableId,                  \/\/ Table id (format ga:xxxxxx).       sLastMonthRange[0],                \/\/ Start-date (format yyyy-MM-dd).       sLastMonthRange[1],                  \/\/ End-date (format yyyy-MM-dd).       'ga:visits, ga:pageviews,ga:goalCompletionsAll', \/\/ Comma seperated list of metrics. ( https:\/\/developers.google.com\/analytics\/resources\/articles\/gdataCommonQueries)        optArgs);    if (results.getRows()) {     return results;    } else {     throw new Error('No profiles found');   } } \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u0430\u0442 function getLastNdays(nDaysAgo) {   var today = new Date();    var before = new Date();   before.setDate(today.getDate() - nDaysAgo);   return Utilities.formatDate(before, 'GMT', 'yyyy-MM-dd'); }  function getLastMonth() {   var sNow = new Date();   var dd = sNow.getDate();   var mm = sNow.getMonth();    var yyyy = sNow.getFullYear();   var sStart = new Date( yyyy, mm-1, 2, 0,0,1  );   var sDays = daysInMonth(yyyy, mm-1) ;   var sEnd = new Date( yyyy, mm-1, sDays+1, 0,0,1 );   \/\/Logger.log(sStart + &quot; &quot; + sEnd + ' -- ' + sDays);    return [ Utilities.formatDate(sStart, 'GMT', 'yyyy-MM-dd') ,  Utilities.formatDate(sEnd, 'GMT', 'yyyy-MM-dd') ] ; } function daysInMonth(year, month) {     return new Date(year, month, 0).getDate(); }  <\/code><\/pre>\n<p>  \u041c\u0435\u0441\u0442\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u044f \u043f\u043e\u043c\u0435\u0442\u0438\u043b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0441 \u043f\u0430\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c <b>\u201c!!!!!\u201d<\/b>. <br \/>   \u0421\u043a\u0440\u0438\u043f\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0440\u0443\u043a\u0430\u043c\u0438 \u0440\u0430\u0437 \u0432 \u043c\u0435\u0441\u044f\u0446. \u0410 \u043c\u043e\u0436\u043d\u043e \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u0440\u043e\u043d \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u201c\u041c\u0435\u043d\u044e -&gt; Resour\u0441e -&gt; Manage Triggers\u201d.<br \/>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u201csetNewMetrics()\u201d.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043a\u043e\u043c\u0443-\u0442\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a \u0432 Google Docs. \u041d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e\u0442\u0432\u0435\u0447\u0430\u044e ).    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/170109\/\"> http:\/\/habrahabr.ru\/post\/170109\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0427\u0438\u043d\u0433\u0438\u0441, \u044f \u0441\u043e\u043e\u0441\u043d\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 <a href=\"http:\/\/worksection.com\">Worksection.com<\/a><\/p>\n<p>  \u041c\u044b \u0443 \u0441\u0435\u0431\u044f \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c \u0440\u044f\u0434 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a. \u041f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u044f, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0438, \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438, \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435, \u043e\u0442\u0442\u043e\u043a \u0438 \u0442\u0434. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0432\u0435\u0434\u0435\u043c \u0432 \u0441\u0432\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432 Google Docs. \u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043c\u0435\u0442\u0440\u0438\u043a \u2014 \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u0438\u0441\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0438\u0437 Google Analytics \u0438 \u0438\u0437 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041f\u043e\u0442\u0440\u0430\u0442\u0438\u0432 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043c\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u044d\u0442\u043e\u0442 \u0441\u0431\u043e\u0440. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-170109","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/170109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=170109"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/170109\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=170109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=170109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=170109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}