有谁知道使用Inno Setup计算安装程序安装数量的最佳方法是什么?它可以与GA集成吗?
我在某处读到,通过在安装结束时打开一个PHP页面,我们可以计算安装数量,但我仍然太模糊了。
答案 0 :(得分:3)
您可以使用CurStepChanged
event function发送HTTP请求。
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
WinHttpReq: Variant;
Url: string;
begin
if CurStep = ssDone then
begin
try
Url := 'http://....';
Log('Sending GA request: ' + Url);
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('GET', Url, False);
WinHttpReq.Send('');
Log('GA request result: ' + IntToStr(WinHttpReq.Status) + ' ' + WinHttpReq.StatusText);
except
Log('Error sending GA request: ' + GetExceptionMessage);
end;
end;
end;
不确定您需要使用哪个网址将其与GA相关联。还有另一个问题涉及这部分问题:
Using Google Analytics without Javascript?
您当然可以查询自己进行计算的网页(例如PHP)。
答案 1 :(得分:3)
对于离线整合,必须通过新的“测量协议”访问Google Analytics。以下是Martin的相同示例,但经过修改以访问测量协议:
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
WinHttpReq: Variant;
Url: string;
begin
if CurStep = ssDone then
begin
try
Url := 'http://www.google-analytics.com/collect';
Log('Sending GA request: ' + Url);
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('POST', Url, False);
// see here the parameters : 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');
Log('GA request result: ' + IntToStr(WinHttpReq.Status) + ' ' + WinHttpReq.StatusText);
except
Log('Error sending GA request: ' + GetExceptionMessage);
end;
end;
end;