![](/img/trans.png)
[英]how to extend the get values while using Google Analytics Data API (GA4) in java to get count of screenPageViews?
[英]How to get google analytics data using java?
我正在嘗試使用Java下載Google Analytics(分析)數據。 我使用的是Google開發人員指南提供的快速入門代碼。 我從開發者控制台下載了json格式的oauth憑證文件。 我還給出了程序的json路徑,但出現錯誤。 請幫忙
public class HelloAnalytics {
// Path to client_secrets.json file downloaded from the Developer's Console.
// The path is relative to HelloAnalytics.java.
private static final String CLIENT_SECRET_JSON_RESOURCE = "ga-data-report-7ac3499541bf.json";
// The directory where the user's credentials will be stored.
private static final File DATA_STORE_DIR = new File(
System.getProperty("user.home"), "store/hello_analytics");
private static final String APPLICATION_NAME = "Hello Analytics";
private static final JsonFactory JSON_FACTORY = GsonFactory.getDefaultInstance();
private static NetHttpTransport httpTransport;
private static FileDataStoreFactory dataStoreFactory;
public static void main(String[] args) {
try {
Analytics analytics = initializeAnalytics();
String profile = getFirstProfileId(analytics);
printResults(getResults(analytics, profile));
} catch (Exception e) {
e.printStackTrace();
}
}
我認為答案就在我的文章中: Hello Analytics API:Java快速入門錯誤
您可以在那里查看我的代碼。 我不只是檢查第一個帳戶的第一個網絡屬性的第一個配置文件。 我檢查所有這些,因為更多更好。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.