{"id":5488,"date":"2015-08-21T01:44:46","date_gmt":"2015-08-20T16:44:46","guid":{"rendered":"http:\/\/www.vincentina.net\/?p=5488"},"modified":"2020-02-24T11:56:29","modified_gmt":"2020-02-24T02:56:29","slug":"trying-to-use-api-of-google-analytics","status":"publish","type":"post","link":"https:\/\/www.vincentina.net\/?p=5488","title":{"rendered":"Trying to use API of Google Analytics"},"content":{"rendered":"<p>I use the GUI the page view and the number of hit that we have confirmed, and it can also be checked using the Google&#8217;s API.<br \/>\nLet&#8217;s try to use the API Client Library for Ruby.<br \/>\nWell, what would you do?<\/p>\n<p>Please look at this web site.<\/p>\n<p>Google\u30a2\u30ca\u30ea\u30c6\u30a3\u30af\u30b9\u306e\u30ec\u30dd\u30fc\u30c8\u3092ruby\u304b\u3089\u53d6\u5f97\u3059\u308b<br \/>\nhttp:\/\/blog.naberon.jp\/post\/2013\/08\/25\/google-analytics-api\/<br \/>\n\u203b translate.google : Get a Google Analytics report from ruby<\/p>\n<p>It is roughly like this!<\/p>\n<p>you terribly sloppy. more seriously.<br \/>\nOK. Please let me add a few information.<\/p>\n<p>I will try require.<\/p>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\">\r\nbundle exec irb\r\nirb(main):005:0* require 'google\/api_client'\r\n=&gt; true\r\n<\/pre>\n<p>I&#8217;ll prepare a client_secrets.json for Librarie.<\/p>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\">\r\ncat &gt; client_secrets.json\r\n{&quot;installed&quot;:{&quot;client_id&quot;:&quot;************** \/\/\r\n<\/pre>\n<p>make a Instance.<\/p>\n<p>Authenticate.<\/p>\n<p>make a requests parameters.<\/p>\n<p>\u203bParameter Look here<br \/>\nhttps:\/\/developers.google.com\/apis-explorer\/?hl=ja#p\/analytics\/v3\/<\/p>\n<p>something like that&#8230;<\/p>\n<p>Oops.<br \/>\nOne more thing.<\/p>\n<p>On the GUI, the Analytics API and the requestID, and be enabled. It is important!!<\/p>\n<p>Execution result<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\/?p=4330\r\nSSG5\u3092\u3044\u3058\u308c\u308b\u72b6\u614b\u307e\u3067\u8a2d\u5b9a\u3057\u3088\u3046\r\n284\r\n326\r\n381\r\n\/?p=5153\r\nHTTP2.0\u304c\u3084\u3063\u3066\u304f\u308b\uff1fHTTP1.1\u3001HTTP1.0\u306e\u52c9\u5f37\u3092\u3057\u3066\u304a\u3053\u3046\u304b\u3002\r\n207\r\n213\r\n221\r\n\/?p=3530\r\nKVM\uff0bScientificLinux Virsh-install\u3057\u305f\u6642\u306e\u30a8\u30e9\u30fc\u305f\u3061\r\n150\r\n172\r\n200\r\n<\/pre>\n<p>there&#8217;s nothing to it.<br \/>\nLet\u2019s get started.<br \/>\nJust Do It.<\/p>\n<div class='wp_social_bookmarking_light'>        <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.vincentina.net\/?p=5488\" data-text=\"Trying to use API of Google Analytics\" data-via=\"TakekenTw\" data-lang=\"ja\">Tweet<\/a><\/div><\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>I use the GUI the page view and the number of hit that we have confirmed, and it can also be checked using the &hellip; <a href=\"https:\/\/www.vincentina.net\/?p=5488\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Trying to use API of Google Analytics&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117],"tags":[],"class_list":["post-5488","post","type-post","status-publish","format-standard","hentry","category-english"],"_links":{"self":[{"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/posts\/5488","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5488"}],"version-history":[{"count":0,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/posts\/5488\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vincentina.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}