Sometimes an installation package may need to collect installation data and send it to your web server.
You may need to collect, by means of Windows Installer properties, usage information statistics, hardware information or user information such as:
- User information - USERNAME, COMPANYNAME, LogonUser, UserLanguageID, etc.
- Operating system - SystemLanguageID, Version9X, VersionNT, VersionNT64, ServicePackLevel, WindowsBuild, etc.
- Hardware configuration - Intel, Intel64, AMD64, PhysicalMemory, VirtualMemory, ScreenX, ScreenY, ColorBits, etc.
- Other custom collected information - any property value you set by a Windows Installer search, standard or custom actions.
What information to collect?
You need to specify what information should be collected and sent to your web server. Install information can only be collected through Windows Installer properties (their values). You can specify what property values should be collected by enumerating their names in the Advanced Installer special property called: HttpPostCollectData, separated by ; . This property can also be set from Send install information to your web server custom action by populating the property list control in its properties pane.
For example, if you want to collect the user name, the company name, the user's email, and his language, you set the property HttpPostCollectData with the value: USERNAME;COMPANYNAME;USER_EMAIL;UserLanguageID. (Some built-in Windows Installer properties are automatically set by the package, other custom properties must be set by means of package UI or custom actions.)
Where to submit the collected information ?
You can specify the URL where the collected information should be submitted in the Windows Installer property: HttpPostUrl. This property can be set from the Web Server URL field in the "Send install information to your web server" custom action properties pane. For instance, set the HttpPostUrl property or Web Server URL field with the value: http://www.example.com/myapp/collectdata.php. Your web server must host a web application capable of processing and storing the received information. You can use the Apache/PHP/MySQL suite or IIS/ASP.NET/MS-SQL suite or any other web technology convenient to you.
How is the collected information is sent?
The web transfer protocol is HTTP/1.1 or HTTPS (depending on the URL you specify). The submit request method is POST. The HTTP headers specify the following "Content-Type":
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Advanced Installer will send every property you specify in HttpPostCollectData as a POST variable, with its value set according to the installation state.
In the above example, the following POST variables will be set:
- USERNAME = User Name
- COMPANYNAME = User's Company
- USER_EMAIL = firstname.lastname@example.org
- UserLanguageID = 1033 (English US)
Web Server Response
The HTTP server request response, if any, can be accessed through the Advanced Installer; property: HttpPostServerResponse. You can use the value of this property to organize the logic of your installation package.
During an HTTP POST request a "Please wait..." message box will be spawned in the installation package. You can suppress the spawned message box by setting the HttpPostSuppressSpawnMsgBox property to 1 or by enabling the "Suppress spawned message box" option from "Send install information to your web server" custom action's properties pane.
How to use
In your Advanced Installer project
Go to the Custom Actions page and add the predefined UI Custom Action "Send install information to your web server" without sequence. Give this custom action a meaningful name like SendCollectedData.
Go to the Dialog Editor page.
Create a new dialog in order to collect the information you want.
- Select the edit box next to the "User Name" and set its property name to USERNAME.
- Select the edit box next to the "Company" and set its property name to COMPANYNAME.
- Select the edit box next to the "Email" and set its property name to USER_EMAIL.
- Select the "Product Registration" Radio Button Group and set its property name to IAgree.
- Select the "Register Collect installation data sample" Radio Button and set its value to Yes.
- Select the "Do not register Collect installation data sample at this time" Radio Button and set its value to No.
Go to Events Editor tab (Dialog Editor view) and add the following published events on the button:
Add two Set installer property value events for the "HttpPostUrl" and "HttpPostCollectData" properties. This step can be skipped if you set the Web Server URL and Property list controls from "Send install information to your web server" custom action's properties pane.
- Name: [HttpPostUrl]
- Argument: http://www.example.com/myapp/collect_db.php
- Condition: 1
- Name: [HttpPostCollectData]
- Argument: USERNAME;COMPANYNAME;USER_EMAIL;UserLanguageID
- Condition: 1
Add an Execute custom action event which will execute the HTTP POST operation.
- Name: Execute custom action
- Argument: SendCollectedData (the custom action name you created earlier)
In your web server application
Your web application should be able to handle retrieving POST variables sent by the installer package. In this case, the following variables will be POSTed: USERNAME, COMPANYNAME, USER_EMAIL, UserLanguageID. You can choose to use the collected information as you need, as long as you disclose to your client what data you collect and for what purpose.
You can download an example which uses a PHP script over a MySQL database or uses a server install/registration log file.