Track your Delphi/Pascal GUI application with Google Analytics

What is SoftMeter?

Quick answer: SoftMeter is "Google Analytics for desktop applications".

Longer answer: Google Analytics (GA) is the most popular website statistics tool. It shows statistics about the visitors to your website. Also, it is free. Apart from websites, GA can also track Firebase mobile apps.

SoftMeter application analytics and statisticsSoftMeter is a very small software library that extends the coverage of GA to include desktop applications (Windows and MacOS; IOS coming soon). Also, it has a free edition.

By including SoftMeter in your desktop application you will be able to see how users around the world use your application. Just like you monitor how the visitors' traffic on your website.

You can link our SoftMeter DLL with your Delphi/Pascal software and see the usage statistics in Google Analytics, for free. SoftMeter is an API client of the Google measurement protocol and connects any desktop application with the Google Analytics reporting platform.

If you are a shareware developer, you will be able to see the ratio of the free installations vs the paying users of your shareware and understand the conversion bottlenecks.

SoftMeter provides usage statistics like:

  • Installs vs uninstalls.
  • Users' countries and prefered languages.
  • Operating systems and screen resolutions.
  • Active installations.
  • App versions and editions (e.g. Free vs Paid)
  • Most and least used features of the program
  • Crashes and exceptions

The implementation is kept very easy. You can complete it in a few hours (together with the setup of the Google Analytics property), and start seeing real-time and historical data of your software's usage around the world.

In your Delphi project you will need a new unit to hold the global object of the SoftMeter class. You will use this object from various places of your software to send hits to your Google Analytics property.

A minimal example of the new unit: "softMeter_globalVar.pas"


unit softMeter_globalVar;

interface

uses dll_loaderAppTelemetry;

// this is the global variable that multiple units of the application will use
var dllSoftMeter: TDllAppTelemetry;

implementation 

initialization
  
  userGaveConsent:= true; // make sure you load this variable from the user settings
  dllSoftMeter := TDllAppTelemetry.Create(DLLfilename);
  dllSoftMeter.start(AppName, AppVersion, AppLicense, AppEdition, GooglePropertyID, userGaveConsent );
  
finalization

  dllSoftMeter.stop;
  

If you have a base form that all other forms inherit from, add the tracking code in the base form.

It would be good to add an "Enable analytics" form property so that you can disable the tracking of non-important forms. Reducing the google analytics hits, allows you to focus on the important hit sequences.

A minimal example of the base form:


procedure TBaseForm.FormShow(Sender: TObject);
begin
  // send a pageView hit on Form Show
  dllSoftMeter.sendPageview( 'MainForm/' , 'MainForm' ); // you can pick the form's caption dynamically.
  // or send screenView
  dllSoftMeter.sendScreenView('MainForm');
end; 

If you have important button clicks that you want to track, e.g. click on the "buy now" or the "Donate" button, you can send event hits.

A minimal example of sending event hits:


procedure TForm1.Button1Click(Sender: TObject);
begin
  dllSoftMeter.sendEvent('Conversion events', 'Donate clicked', 1);
end;

You can see the full Delphi GUI application example at our Github page.

After implementing SoftMeter with your Delphi software, you can log in to Google Analytics and see reports and graphs like the following:

shareware report on active installations

real time users in Google Analytics

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

plain text with line breaks

  • Allowed HTML tags: <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <br>
  • No HTML tags allowed.
  • Lines and paragraphs break automatically.