Tracking Installations & Uninstallations into your MSI/Windows Installer

Are you interested in knowing how many users install and uninstall your softwarei through your MSI/Windows Installer? You came to the right place! To get started download the DeskMetrics Analytics MSI DLL ANSI or Unicode.

Using Microsoft Visual Studio

Add a new custom action:

  • In the Solution Explorer, right-click on your Setup, click View and the Custom Actions:
Adding a Custom Action
  • Select the Install method and with the right mouse button, click on “Add Custom Action...” and add the DeskMetricsMSI.dll ANSI or Unicode:
Adding a Custom Action
  • Now click on DeskMetricsMSI.dll and edit the following properties: Condition = “Not Installed” and EntryPoint = “DeskMetricsTrackInstallation”:
Adding a Custom Action
  • Select the Uninstall method and with the right mouse button, click on “Add Custom Action...” and add the DeskMetricsMSI.dll
  • Now click on DeskMetricsMSI.dll and edit the EntryPoint to “DeskMetricsTrackUninstallation”:
Adding a Custom Action

You need to edit the MSI package properties and the custom actions. You will need to use ORCA to do this. For information about how to use ORCA, see the MSDN Web site.

To edit a MSI package using ORCA:

  • With ORCA opened, click on File, Open, browse to the location of the MSI file and then click Open.
  • In the Tables column, click Property.
  • Right-click anywhere in the column area where the Property and Value columns are listed, and then click Add Row.
Using ORCA to edit a MSI package
  • In the Add Row dialog, type DeskMetricsID as the Property, click Value, and then type your application ID. Click OK to apply the property and close the dialog:
Using ORCA to edit a MSI package
  • Click File and then Save
  • In the Tables column, click CustomAction.
  • Double-click on Type where Target = DeskMetricsTrackInstallation and set Type Value = 193. Do the same where Target = DeskMetricsTrackUninstallation.
Using ORCA to edit a MSI package
  • Click File, Save and then click Exit to close ORCA.

You’re done!

Using Windows Installer XML (WiX) Toolset

Windows Installer XML (Wix) is a toolset that builds Windows Installer (MSI) packages from an XML document. More details can be found here. Here is what you need to add in orther to track installations and Uninstallations:

<Binary Id="DeskMetricsMSI.dll" SourceFile="DeskMetricsMSI.dll" />

<CustomAction Id="DeskMetricsTrackInstallation" DllEntry="DeskMetricsTrackInstallation"
BinaryKey="DeskMetricsMSI.dll" Execute="immediate" Return="ignore" />

<CustomAction Id="DeskMetricsTrackUninstallation" DllEntry="DeskMetricsTrackUninstallation"
 BinaryKey="DeskMetricsMSI.dll" Execute="immediate" Return="ignore" />

<CustomAction Id="DeskMetricsTrackRollback" DllEntry="DeskMetricsTrackRollback"
 BinaryKey="DeskMetricsMSI.dll" Execute="immediate" Return="ignore" />

<Property Id="DeskMetricsID" Value="YOUR APPLICATION ID" />

Using Advanced Installer or other third-party tool

  • You need to create a property called DeskMetricsID and set your application ID.
Using Advanced Installer
  • Add new customs actions with these properties:

    Track Installations

    • Function Name: DeskMetricsTrackInstallation
    • Execution Properties: Asynchronous execution, do not wait for return
    • Execution Options: Immediate execution

    Track Uninstallations

    • Function Name: DeskMetricsTrackUninstallation
    • Execution Properties: Asynchronous execution, do not wait for return
    • Execution Options: Immediate execution
Advanced Installer Custom Actions

You’re done!