return allProfileMetrics;
}
private Analytics initializeAnalytics() {
if (analytics == null) {
GoogleAnalyticsProvider provider = new GoogleAnalyticsProvider();
TokenResponse tokenResponse = new TokenResponse().setRefreshToken(getConnectionCredentials().getOauthRefreshToken());
GoogleCredential credential = new GoogleCredential.Builder()
.setJsonFactory(jsonFactory)
.setTransport(transport)
.setClientSecrets(provider.getClientId(), provider.getClientSecret())
.build()
.setFromTokenResponse(tokenResponse);
analytics = new Analytics.Builder(transport, jsonFactory, credential).build();
}
return analytics;