Google analytics 使用Inno安装程序计算安装计数

Google analytics 使用Inno安装程序计算安装计数,google-analytics,inno-setup,Google Analytics,Inno Setup,有人知道使用Inno Setup计算安装程序安装计数的最佳方法吗?它能与遗传算法集成吗 我在某个地方读到,通过在安装结束时打开一个PHP页面,我们可以计算安装计数,但这对我来说还是太模糊了。您可以使用CurStepChanged发送HTTP请求 [代码] 过程CurStepChanged(CurStep:TSetupStep); 变量 WinHttpReq:变体; Url:string; 开始 如果CurStep=ssDone,则 开始 尝试 网址:='http://....'; 日志(“发送G

有人知道使用Inno Setup计算安装程序安装计数的最佳方法吗?它能与遗传算法集成吗


我在某个地方读到,通过在安装结束时打开一个PHP页面,我们可以计算安装计数,但这对我来说还是太模糊了。

您可以使用
CurStepChanged
发送HTTP请求

[代码]
过程CurStepChanged(CurStep:TSetupStep);
变量
WinHttpReq:变体;
Url:string;
开始
如果CurStep=ssDone,则
开始
尝试
网址:='http://....';
日志(“发送GA请求:”+Url);
WinHttpRequest:=CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('GET',Url,False);
WinHttpReq.Send(“”);
日志('GA请求结果:'+IntToStr(WinHttpReq.Status)+'+WinHttpReq.StatusText);
除了
日志('发送GA请求时出错:'+GetExceptionMessage);
结束;
结束;
结束;

但是,不确定需要使用什么URL将其链接到GA。还有一个问题涉及这部分问题:


当然,您可以查询自己进行计算的网页(如PHP)。

您可以使用
CurStepChanged
发送HTTP请求

[代码]
过程CurStepChanged(CurStep:TSetupStep);
变量
WinHttpReq:变体;
Url:string;
开始
如果CurStep=ssDone,则
开始
尝试
网址:='http://....';
日志(“发送GA请求:”+Url);
WinHttpRequest:=CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('GET',Url,False);
WinHttpReq.Send(“”);
日志('GA请求结果:'+IntToStr(WinHttpReq.Status)+'+WinHttpReq.StatusText);
除了
日志('发送GA请求时出错:'+GetExceptionMessage);
结束;
结束;
结束;

但是,不确定需要使用什么URL将其链接到GA。还有一个问题涉及这部分问题:


当然,您可以查询自己进行计算的网页(如PHP)。

对于离线集成,必须通过新的测量协议访问Google Analytics。以下是Martin提供的相同示例,但经过修改以访问测量协议:

[代码]
过程CurStepChanged(CurStep:TSetupStep);
变量
WinHttpReq:变体;
Url:string;
开始
如果CurStep=ssDone,则
开始
尝试
网址:='http://www.google-analytics.com/collect';
日志(“发送GA请求:”+Url);
WinHttpRequest:=CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('POST',Url,False);
//请参见此处的参数:https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#required
WinHttpReq.Send('v=1&tid=UA-XXXXX-Y&cid=555&t=pageview&dp=%2mywebpage');
日志('GA请求结果:'+IntToStr(WinHttpReq.Status)+'+WinHttpReq.StatusText);
除了
日志('发送GA请求时出错:'+GetExceptionMessage);
结束;
结束;
结束;

请阅读。

对于离线集成,必须通过新的测量协议访问Google Analytics。以下是Martin提供的相同示例,但经过修改以访问测量协议:

[代码]
过程CurStepChanged(CurStep:TSetupStep);
变量
WinHttpReq:变体;
Url:string;
开始
如果CurStep=ssDone,则
开始
尝试
网址:='http://www.google-analytics.com/collect';
日志(“发送GA请求:”+Url);
WinHttpRequest:=CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('POST',Url,False);
//请参见此处的参数:https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#required
WinHttpReq.Send('v=1&tid=UA-XXXXX-Y&cid=555&t=pageview&dp=%2mywebpage');
日志('GA请求结果:'+IntToStr(WinHttpReq.Status)+'+WinHttpReq.StatusText);
除了
日志('发送GA请求时出错:'+GetExceptionMessage);
结束;
结束;
结束;
阅读关于这个问题的文章