How to Monitor Application Performance? — Part 1: Customer Behavior Tracking
Let us consider an eCommerce application as subject for this series of discussions. I would also refer to Azure as my cloud provider at certain points. Yet, this content would be transferable to other providers.
We have discussed the introductive contents in the blog “Application Performance Monitoring”.
The core requirement of monitoring is customer retention for profit making. Let’s start with that.
Customer Behavior Tracking
For many it sounds unethical, for tracking their behavior in an application software. It is likely that you have “Accepted” the T&C for the same to read this very blog post with Medium. Data Laws in the Operating and Serving countries provision privacy rights to its users. To which all service providers have to be diligently bound. This is an ethical practice to conduct service improvisation and optimization at product level with priority to User Privacy.
What are the collectibles?
- User triggered events: A payment initiation, cancellation of an order, opening camera for scanning QR, etc. are all events that relevant to track. This allows to add new application features with real world scenarios.
- System Events: User switching to Dark Mode, Silent Mode or going offline are system events. This help adapt the application based on color codes, sounds, and offline usage.
- Code flow events: Login is User triggered event. Activity after receiving Auth token or 4XX response is handled by code. Any event that is abstracted from User Interface is code flow events. This helps debug the application exceptions and resolve it before it becomes a Priority Ticket.
- Page visits: Page views are essential for all digital products and blogs. There is monetization based on Page Views. Ad spaces and promoted products on eCommerce pages require analytics on how many total and unique views were obtained, to calculate ROI.
- Activity Throughput/Latency: Any content that is rendered to User is based on requests send to Server and response received by the User’s device. Connectivity, server response time, total time till first byte, are all factors that account for system performance. This helps identify User path that has bottleneck and help initiate analysis to identify which component caused the bottleneck.
- Usage Pattern: Every user has their distinctive behavior while using the application. Some do window shopping, while others hoard on clothes. The idea to identify usage pattern help understand classifications of user demography, time of day, frequency, time spend, etc. This helps scale the application for optimal performance and minimal costs.
Some snippets
Here are simply collecting data from an Angular App with Azure Application Insights SDK.
- Install the SDK
npm install @microsoft/applicationinsights-web --save
2. Import required packages in your component
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
import { Injectable } from '@angular/core';
3. Create service and initialize properties and events
logPageView(name?: string, uri?: string, properties?: any, measurements?: any, duration?: number) {
this.appInsights.trackPageView({ name, uri, properties, measurements, duration });
}
logEvent(name: string, properties?: any, measurements?: any) {
this.appInsights.trackEvent({ name, properties, measurements });
}
4. Call the methods to send data across
// log a page view
this.appInsightsService.logPageView(URL);
// log an event
this.appInsightsService.logEvent('button_click', { button_id: 'submit_button' });
The snippets are generic examples, you can start here for further reading. Play around the same to get more insights into development. If you have further questions, DM me on LinkedIn.
That’s all for this blog. Thanks for reading through.
Will delve into more of cloud aspects with “Backend Application Monitoring” in the next post.