Browse Source

GTMAdmin service

wfansh 5 months ago
parent
commit
4fc5f61e61

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

@@ -0,0 +1,46 @@
+package org.jeecg.modules.adweb.dmp.service.google;
+
+import jakarta.annotation.PostConstruct;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.jeecg.modules.adweb.common.util.RestTemplateUtil;
+import org.jeecg.modules.adweb.dmp.dto.google.analytics.GAPropertyDTO;
+import org.jeecg.modules.adweb.dmp.dto.google.gtm.GTMContainerDTO;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * Google Tag Manager + Google Analytics帐号及标签管理
+ *
+ * <p>http://data-bridge.v3.adwebcloud.com:9002/swagger-ui/index.html
+ *
+ * @author wfansh
+ */
+@Service
+public class GTMAdminService {
+
+    private static final String GA_PROPERTY_CREATE_API_PATH = "/api/google/ga/properties/create";
+    private static final String GTM_CONTAINER_CREATE_API_PATH = "/api/google/gtm/containers/create";
+    private static final String GTM_CONTAINER_GET_API_PATH = "/api/google/gtm/containers/create";
+
+    @Value("${data-bridge.api.host}")
+    private String dataBridgeApiHost;
+
+    @Value("${data-bridge.api.token}")
+    private String dataBridgeApiToken;
+
+    private RestTemplate restTemplate;
+
+    @PostConstruct
+    private void init() {
+        this.restTemplate = RestTemplateUtil.getRestTemplate(60, 60, dataBridgeApiToken);
+    }
+
+    /** 创建Google Analytics + Google Tag Manager标签 */
+    public Pair<GAPropertyDTO, GTMContainerDTO> createTags(
+            String siteCode, String siteUrl, String siteName) {
+
+        // TODO
+    }
+}