# Gathering install/uninstall analytics with TrackToAct

So you’ve built your product, set up your website and are allowing people to try your application by downloading a free trial. You can easily track the number of visitors to your website and you are able to generate some pretty insightful reports on them as well by using [Google Analytics](http://www.google.co.za/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCAQFjAA&url=http%3A%2F%2Fwww.google.com%2Fanalytics%2F&ei=zUh5UML8I8-DhQeKuIH4Dw&usg=AFQjCNFz3Lrd3h9xlat60IUur_H8rmADdw).

You can see how many people are downloading your application, but how do you know if the user that downloaded your application is actually installing and using it? It would also be great to gain some insight to see if once users installed the trial version of your application whether they uninstall it and how quickly since they’ve installed it, it was uninstalled.

Enter TrackToAct… By using their API, I can add custom actions to my setup project and track how and when users install and uninstall my application. In this article I’ll show you how you too can use this functionality to gain valuable insight into your users’ experiences.

##### Adding a custom action

We’ll assume we’ve already created a Windows forms application project and added a new setup project as well. In order to track the installs and uninstalls we need to add our own custom action.

Add a new C# Class Library Project to your Visual Studio solution.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1664194684151/no1pp07lP.png align="left")

This will create a new class library project. Next, add a new Installer Class to the class library project:


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1664194699553/6yLB19tD4.png align="left")

Before we can add tracking code, we need to add the **tracktoact.dll** as a reference to our project.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1664194718358/_HJY7-e83.png align="left")

You can find the .Net assemblies for TrackToAct, when you log into your account and click on Event Sensor. From there you have a choice to download or use one of the following:

*   Windows DLL, can be used in C, C++ and Office VBA;
    
*   .Net DLL, for use with all .Net applications;
    
*   Javascript, can be used for all web, PhoneGap and even Office 2013 Apps; and
    
*   VBA Snippet, a very neat and easy way to embed TrackToAct in your VBA apps or MS Office documents.    

Once you’ve added the .Net dll to your project, add the following code to the **Custom Installer** class:

```csharp
public override void Install(IDictionary stateSaver)
{
  TrackToAct.Service.T2ASdk_InvokeRemoteService("--YOURAPPID—", "Installation","Installed");
  base.Install(stateSaver);
}

public override void Uninstall(IDictionary savedState)
{
  TrackToAct.Service.T2ASdk_InvokeRemoteService("--YOURAPPID—",

   "Installation","Uninstalled");
  base.Uninstall(savedState);
}
```

##### Adding the custom action to your setup package

Right-click on the setup project and select _Project Output…_ from the _Add_ menu.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1664194763627/I9AwGFDfV.png align="left")

Select the Primary output of the class library we’ve added to the project earlier.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1664194776222/MaGoDrqqL.png align="left")

Next, click on the _Custom Actions Editor_ button in the Solution Explorer toolbar.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1664194793975/P6A8Tffl0.png align="left")

Right-click on the Install node and select _Add Custom Action…_

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1664194807371/8XO0Uq6dW.png align="left")

Select the Primary output for the class library we’ve added earlier and click OK.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1664194820656/jzmuDfsWCR.png align="left")

Do exactly the same for the Uninstall node. The Custom Actions windows should resemble the following once you are done:

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1664194840917/QGD8kMx-5.png align="left")

You are now ready to build your setup project and deploy it to your users. As they install and uninstall your application, the tracking code will save the usage data to TrackToAct and you would be able to gain insights into the number of users that installed and uninstalled your application.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1664194854960/MI4wtvW_p.png align="left")

By using this approach you can implement steps to determine why people are uninstalling your application or why your application is downloaded but never installed. Perhaps your installation is too complex or intimidating for the user, maybe after they have installed the application it appears not to be working or is not working at all..

Your installation is the first impression the user gets and it is very important that it is a painless and easy experience.

Thank you for reading! Until next time, be sure to visit the [TrackToAct website](http://www.TrackToAct.com) and see how they can help you convert more downloads into sales, by signing up for a free account.

> This was a paid-for article brought to you by [TrackToAct](http://www.TractToAct.com). 
