google analytics reporting api: bebendo água direto da fonte
DESCRIPTION
Slides da palestra "Google Analytics Reporting API: Bebendo água direto da fonte" no Google Analytics User Conference Brasil 2012TRANSCRIPT
![Page 1: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/1.jpg)
Google Analytics Reporting API
Bebendo água direto da fonte
@johannvivot
![Page 2: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/2.jpg)
Rotinas e padrões estabelecidos para a utilização externa de funcionalidades e serviços
de um sistema.
Como assim, API!?
![Page 3: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/3.jpg)
Why!?
![Page 4: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/4.jpg)
VelocidadeFlexibilidadeExtensibilidade
![Page 5: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/5.jpg)
e.g.
http://www.google.com/analytics/apps/Mais:
![Page 6: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/6.jpg)
![Page 7: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/7.jpg)
Google Analytics APIs
Configuration Reporting
Management API Core Reporting API
Multi-Channel Funnels Reporting
API
![Page 8: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/8.jpg)
Management API
Informações de configuração dos usuários do Google Analytics.
![Page 9: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/9.jpg)
Reporting – Core Reporting API
Maior parte de core reports do Google Analytics.
![Page 10: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/10.jpg)
Reporting – MCF Reporting API
Dados de Multi-Channel Funnels de um usuário.
![Page 11: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/11.jpg)
Ok, mas o que vou precisar?
++ +
![Page 12: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/12.jpg)
Ok, mas o que vou precisar?
![Page 13: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/13.jpg)
Criando Projeto
http://code.google.com/apis/console/
![Page 14: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/14.jpg)
Criando Perfil de Acesso
http://code.google.com/apis/console/
![Page 15: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/15.jpg)
Escolhendo sua linguagem
http://developers.google.com/analytics/devguides/reporting/core/v3/gdataLibraries
![Page 16: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/16.jpg)
![Page 17: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/17.jpg)
Autorização...
<script src="https://apis.google.com/js/client.js"></script>
...
<script> function auth() { var config = { 'client_id': ‘YOUR_CLIENT_ID', 'scope': 'https://www.googleapis.com/auth/analytics.readonly' };
gapi.auth.authorize(config, function() { console.log('login complete'); console.log(gapi.auth.getToken()); }); }</script>
...<button onclick="auth();">Autorizar</button>...
https://github.com/johannvivot/gauc2012
![Page 18: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/18.jpg)
Contas...
<script src="https://apis.google.com/js/client.js"></script>
...
<script> function management_accounts() { gapi.client.load('analytics', 'v3', make_management_api_accounts_call); }
function make_management_api_accounts_call() { gapi.client.analytics.management.accounts.list().execute(YOUR_HANDLER); }</script>
...
<button onclick="management_accounts();">Buscar Contas</button>
...
https://github.com/johannvivot/gauc2012
![Page 19: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/19.jpg)
Web Properties...
<script src="https://apis.google.com/js/client.js"></script>
...
<script> function management_web_properties() { gapi.client.load('analytics', 'v3', make_management_api_web_properties_call); }
function make_management_api_web_properties_call() { gapi.client.analytics.management.webproperties.list({ 'accountId': ACCOUNT_ID }).execute(YOUR_HANDLER); }</script>
...
<button onclick="management_web_properties();">Buscar Web Properties</button>
...
https://github.com/johannvivot/gauc2012
![Page 20: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/20.jpg)
Perfis...
<script src="https://apis.google.com/js/client.js"></script>
...
<script> function management_profiles() { gapi.client.load('analytics', 'v3', make_management_api_profiles_call); }
function make_management_api_profiles_call() { gapi.client.analytics.management.profiles.list({ 'accountId': ACCOUNT_ID, 'webPropertyId': WEB_PROPERTY }).execute(YOUR_HANDLER); }</script>
...
<button onclick="management_profiles();">Buscar Perfis</button>
...
https://github.com/johannvivot/gauc2012
![Page 21: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/21.jpg)
Consulta...<script src="https://apis.google.com/js/client.js"></script>...<script> function core_reports_visits() { gapi.client.load('analytics', 'v3', make_core_reports_api_call); }
function make_core_reports_api_call() { gapi.client.analytics.data.ga.get({ 'ids': TABLE_ID, // e.g. ga:xxxxxxx 'start-date': START_DATE, 'end-date': END_DATE, 'metrics': 'ga:visits', // METRICS 'dimensions': 'ga:source', // DIMENSIONS 'sort': '-ga:visits,ga:source', // SORT 'max-results': 10000 // MAX RESULTS }).execute(YOUR_HANDLER); }</script>...<button onclick="core_reports_visits();">Buscar Visitas</button>...
https://github.com/johannvivot/gauc2012
![Page 22: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/22.jpg)
Guiaids = string *
start-date = string *
end-date = string *
metrics = string *
dimensions = string
sort = string
filters = string
segment = string
start-index = integer
max-results = integer
fields = string
prettyPrint = boolean
userIp = string
quotaUser = string
access_token = string
callback = string
key = string
* Campos obrigatórios
![Page 23: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/23.jpg)
Sampling
Google Analytics realiza certos cálculos on the fly. Não fique triste, use containsSampledData.
![Page 24: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/24.jpg)
Brincando com Peixe Grande
Menos dimensões
Quebre por datas
Pagine seus dados
gzip
![Page 25: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/25.jpg)
Dimensões e Métricas
https://developers.google.com/analytics/devguides/reporting/core/dimsmets
![Page 26: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/26.jpg)
Limites da API
Geral50.000 requests por projeto por dia10 queries por segundo por IP
Core Reporting API10.000 requests por perfil por dia10 requests concorrentes por perfil
![Page 27: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/27.jpg)
Dica – Data Feed Query Explorer
http://ga-dev-tools.appspot.com/explorer/
![Page 28: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/28.jpg)
![Page 29: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/29.jpg)
![Page 30: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/30.jpg)
To infinity, and beyond!
![Page 31: Google Analytics Reporting API: Bebendo água direto da fonte](https://reader033.vdocuments.mx/reader033/viewer/2022061122/546fbb0eb4af9f16648b45d7/html5/thumbnails/31.jpg)
Dúvidas!?