gpt4 book ai didi

google-analytics - 服务器端电子商务交易推送到谷歌分析

转载 作者:行者123 更新时间:2023-12-03 15:39:29 25 4
gpt4 key购买 nike

我正在尝试用最少的信息插入电子商务交易
对于分析,以下是它的两种方法实现,但没有
似乎工作。这些方法是通过引用构建的
论坛上的文档和代码片段。

    public static void pushToGoogleAnalytics(String analyticsCode, String 
domain, String product_sku, String product) {
Map<String, String> params=new TreeMap<String, String>();
params.put("utmwv", 4+"");
params.put("utmn", new Random().nextInt(2147483647)+"");
params.put("utmhn", domain);
params.put("utmipc", product_sku);
params.put("utmipn", product);
params.put("utmtid", product_sku);
params.put("utmdt", product);
params.put("utmp", "/");
params.put("utmhn", domain);
params.put("utmac", analyticsCode);
params.put("utmcc", "__utma%3D999.999.999.999.999.1%3B");
try {
byte[] response = URLUtils.get(new URL("http://www.google-
analytics.com/__utm.gif"), params);
} catch (Exception e) {
e.printStackTrace();
}
}




public static void pushToGoogleAnalytics(String analyticsCode, String
domain, String product_sku, String product) {
String var_utmac = analyticsCode;
String var_utmhn = domain; // domain
String var_utmn = random(1000000000,2147483647)+""; // random number
String var_cookie = random(10000000,99999999)+""; //random cookie
number
String var_random = random(1000000000,2147483647)+""; //number under
2147483647
String var_today = Utils.getNow().getTime()+"";
String var_uservar="-"; // no user-defined
String urchinUrl="http://www.google-analytics.com/__utm.gif?
utmwv=3&utmn="+var_utmn+"&utmipc="+product_sku+"&utmipn="+product
+"&utmtid="+product_sku+"&utmdt=test&utme=&utmcs=-&utmsr=-&utmsc=-
&utmul=-&utmje=0&utmfl=-&utmdt=-&utmhn="+var_utmhn+"&utmhid="+var_utmn
+"&utmac="+var_utmac+"&utmcc=__utma%3D"+var_cookie+"."+var_random
+"."+var_today+"."+var_today+"."+var_today+".2%3B%2B__utmz
%3D"+var_cookie+"."+var_today+".2.2.utmcsr%3D_SOURCE_%7Cutmccn
%3D_CAMPAIGN_%7Cutmcmd%3D_MEDIUM_%7Cutmctr%3D_KEYWORD_%7Cutmcct
%3D_CONTENT_%3B%2B__utmv%3D"+var_cookie+"."+var_uservar+"%3B";
// urchinUrl=urchinUrl.replace("&", "&amp;");
byte[] response = URLUtils.readURL(urchinUrl);
System.err.println("google analytics push URL: "+urchinUrl);
}

最佳答案

请查看this article我最近发表了关于通过 Python 将数据推送到 Google Analytics 的文章。

请注意,它只为您提供最低限度的服务,您可以轻松地将其转换为您喜欢的语言。不过,您需要添加与电子商务相关的参数。

关于google-analytics - 服务器端电子商务交易推送到谷歌分析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8768553/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com