Browse Source

GA report

wfansh 5 months ago
parent
commit
4002c75e25

+ 18 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/service/google/GAReportService.java

@@ -38,6 +38,7 @@ import org.springframework.core.ParameterizedTypeReference;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
 
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
@@ -74,6 +75,23 @@ public class GAReportService {
         this.restTemplate = RestTemplateUtil.getRestTemplate(60, 60, dataBridgeApiToken);
     }
 
+    /** 拉取并同步Google Analytics报表 */
+    public void syncGAReport() {
+        // TODO
+        List<GoogleGTM> googleGTMS = Collections.emptyList();
+
+        // 每个帐号同步三张报表
+        for (GoogleGTM googleGTM : googleGTMS) {
+            try {
+                this.syncGACountryReport(googleGTM);
+                this.syncGASourceMediumReport(googleGTM);
+                this.syncGAPagePathReport(googleGTM);
+            } catch (RuntimeException e) {
+                log.warn("同步GA报表异常, siteId = {], error = {}", googleGTM.getSiteId(), e);
+            }
+        }
+    }
+
     /**
      * 拉取并同步Google Analytics - Country报表
      *