Pintelly

Analytics Features

Pintelly SDK's Analytics module is designed to capture, queue, and efficiently transmit visitor actions with zero external dependencies.

Auto-Capture Features

Once initialized, the SDK automatically collects the following standard metrics without requiring any additional code on your end:

  • Page Views (PageViewed): Fires on initial load, SPA navigation (pushState/replaceState), and hash changes.
  • Element Clicks (ElementClicked): Automatically tracks interactions with BUTTON, A, INPUT, SELECT, and TEXTAREA elements. You can explicitly tag any element for tracking by adding the data-analytics-id="your-id" attribute.
  • Device & Browser Context: OS, browser type, viewport size, and referring URLs.
  • Performance (PagePerformance): Logs First Contentful Paint (FCP) and Largest Contentful Paint (LCP) for Core Web Vitals monitoring.

Programmatic Tracking

While auto-capture handles 90% of use cases, you can track custom business logic using the global MyAnalytics object.

Track Custom Events

MyAnalytics.track('Purchase_Completed', {
  productId: 'prod_123',
  price: 29.99,
  currency: 'USD'
});

All custom events automatically inherit contextual properties (Session ID, User ID, timestamp, User Agent, Page URL).

Identify Users

If your users log into your application, you can map their interactions to their actual Identity:

MyAnalytics.identify('user_987654');

[!TIP] Calling identify stitches their previously anonymous session interactions onto their newly identified User ID.

Data Syncing

To ensure your website's performance is never impacted, the SDK automatically groups multiple events together and sends them to the server in the background.

  • Events are sent automatically every few seconds or when a user leaves the page.
  • You don't need to configure anything; the system is fully automated.

If you ever need to forcefully send data immediately (e.g., right before a critical page redirect), you can manually flush the queue:

await MyAnalytics.flush();