How to Keep Tabs of Your Customers Use of Your VBA Workbooks
February 25, 2018 - by Davor Geci
![How to Keep Tabs of Your Customers Use of Your VBA Workbooks How to Keep Tabs of Your Customers Use of Your VBA Workbooks](/img/news/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks.jpg)
You probably know or have heard of Google Analytics. A tool that tracks and reports website traffic. Similar to Google Analytics there is a Microsoft Application Insights.
From Microsoft:Application Insights is an extensible Application Performance Management (APM) service for web developers on multiple platforms. It includes powerful analytics tools to help you diagnose issues and to understand what users actually do with your app. It’s designed to help you continuously improve performance and usability.
But now with help from VBA Telemetry client, we can connect our desktop applications from Microsft Office product family (Microsoft Access, Microsoft Excel, Microsoft Word, Microsoft Powerpoint,...) to Application Insights.
So, what is VBA Telemetry, in one sentence, please?
VBA Telemetry enables you to Track Events, Errors & Metrics from your VBA projects (Excel workbooks, Access applications) in Real-Time by connecting it to Microsoft Azure Application Insights.
How to Track Events with one line of VBA code
You can track events with one line of VBA code:
![You can track events with one line of VBA code](/img/content/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks-01.jpg)
After those lines of code been executed we have in our Microsoft Azure Application Insights resource:
![Application Insights Usage](/img/content/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks-02.jpg)
![Application Insights Users](/img/content/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks-03.jpg)
![Application Insights Events](/img/content/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks-04.jpg)
Here is a short Youtube video (45 seconds) on how to Track Events within your VBA project by sending telemetry data to Microsoft Azure Application Insights resource using VBA Telemetry client:
How to Track Errors with one line of VBA code
If we want to track Errors we would insert one line of code in our error procedure, example:
![Insert One Line of Code in the Error Procedure to Track Errors](/img/content/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks-05.jpg)
After those lines of code been executed we have in our Microsoft Azure Application Insights resource:
![Azure Application Insights Reports Tracking Errors -Error Description](/img/content/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks-06.jpg)
![Azure Application Insights Reports Tracking Errors -Error Details](/img/content/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks-07.jpg)
Here is a short Youtube video (50 seconds) on how to Track Errors within your VBA project by sending telemetry data to Microsoft Azure Application Insights resource using VBA Telemetry client:
How to Log some custom Metrics with one line of VBA code
If we want to log some custom metrics, for example, to track loop or procedures durations we can do it with using the TrackMetrics function and passing the Metric name and the Metric value, like this:
![TrackMetric Function](/img/content/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks-08.jpg)
After those lines of code been executed we have in our data in Microsoft Azure Application Insights resource.
But to be able to see and query this data we need to go into the Advanced Analytics. In your resource Overview click on Analytics:
![Overview Analytics](/img/content/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks-09.jpg)
This will open a new application “Application Insights Analytics” where you can query all your data in this resource.
![Application Insights Analytics](/img/content/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks-10.jpg)
In Application Insights Analytics you can write your own queries using the Analytics Query language and represent them in various visualization forms (table, charts, export to csv, to Power BI (M Query),...)
Here is the query for data collected in last 63 minutes in our example represented in a timechart and ordered by timestamp:
![Custom Query](/img/content/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks-11.jpg)
Just a preview of translations of the most common idioms between SQL and Analytics Query:
![SQL Query vs Analytics Query](/img/content/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks-12.jpg)
Here is the link to the Cheat Sheet: https://aka.ms/sql-analytics.
Here is the link to Microsoft Analytics in Application Insights documentation.
Want to find out how to connect VBA with Azure?
Full course on how to open a FREE Microsoft Azure account, create your Azure Application Insights resource, connect your VBA project (Excel workbook, Access application) with Azure cloud using VBA Telemetry client and collect your telemetry data you can find in my Udemy course “VBA Application & Usage Monitoring Online with Azure cloud”. (This link is with 90% OFF discount code for MrExcel community.)
In less than 24 hours after the course was published on Udemy, there were more than 2.700+ people enrolled!
![VBA Application & Usage Monitoring Online with Azure Cloud](/img/content/2018/02/how-to-keep-tabs-of-your-customers-use-of-your-vba-workbooks-13.jpg)
Want to see VBA Telemetry LIVE in action?
First ever Live presentation of VBA Telemetry & Azure Application Insights on Access DevCon Vienna.
When: Sat+Sun April 7+8, 2018
Where: Vienna
Who: Karl Donaubauer, Access MVP
Find out more here: Access DevCon Vienna
Title Photo: freeGraphicToday / Pixabay