Skip to main content

Understanding Piano Analytics Data Collection

Piano Analytics uses a simple yet powerful event-driven data model that makes it easy to track user behavior across websites, mobile apps, and server-side applications.

Core Concepts

At the heart of Piano Analytics are two fundamental building blocks:

Events

Events represent specific user interactions or system occurrences you want to measure:

  • Page views (page.display) - When users visit pages
  • Clicks (click.navigation) - When users interact with elements
  • Purchases (transaction.confirmation) - When users complete transactions
  • Video plays (av.play) - When users engage with media
  • Custom events - Any business-specific interactions you define

Properties

Properties provide context and details about each event:

  • Page information (page, page_chapter1) - Where the event happened
  • Content details (article_title, product_name) - What was involved
  • User attributes (user_id, user_category) - Who performed the action
  • Technical data (device_type, browser) - How the event occurred

Example: A page view event might include properties like page name, category, publication date, and user status.

Data Model Flexibility

Standard Properties (450+ available)

Piano Analytics provides an extensive library of pre-defined events and properties covering common analytics scenarios:

  • Web analytics - Page views, navigation, search
  • E-commerce - Product views, cart actions, purchases
  • Media - Video/audio playback, engagement metrics
  • Mobile apps - Screen views, app lifecycle events

→ View standard events documentation

Custom Properties

For unique business requirements, create custom events and properties to capture specific interactions:

// Custom event example
pa.sendEvent("newsletter.signup", {
newsletter_type: "weekly",
signup_source: "homepage_banner",
user_segment: "premium",
});

Property Processing Types

Piano Analytics handles two types of properties:

  • Processed Properties: Sent directly in your tracking code and immediately available in reports
  • Calculated Properties: Computed during data processing (e.g., session duration, bounce rate)

The data model documentation specifies which properties to include in your tracking implementation.

Getting Started: Your First Events

The best way to understand Piano Analytics is through practical examples. Let's walk through implementing basic tracking for your website or application.

Quick Start with Instant Tracking

>= 6.16.0 For websites: The fastest way to start collecting data is with Instant Tracking. Add one script to automatically track page views and basic interactions:

Benefits:

  • ✅ Immediate data collection with zero configuration
  • ✅ Automatic page view tracking
  • ✅ Built-in privacy controls
  • ✅ Minimal code required
<html>
<head lang="en">
<meta charset="UTF-8" />
<title>My Page</title>
<script>
(function (_config) {
var script = document.createElement("script");
script.src = "https://tag.aticdn.net/piano-analytics.js";
script.async = true;
script.crossorigin = "anonymous";
script.dataset.config = JSON.stringify(_config);
document.head.appendChild(script);
})({
site: 123456789,
collectDomain: "https://xxxxxxx.pa-cd.com",
instantTracking: true,
});
</script>
</head>
<body>
...
</body>
</html>

Example 1: Tracking Page Views

The foundation of web analytics is measuring when users view pages. Here's how to send a page.display event with contextual properties:

<html>
<head lang="en">
<meta charset="UTF-8" />
<title>My Page</title>
<script>
(function (_config) {
var script = document.createElement("script");
script.src = "https://tag.aticdn.net/piano-analytics.js";
script.async = true;
script.crossorigin = "anonymous";
script.dataset.config = JSON.stringify(_config);
document.head.appendChild(script);
})({
site: 123456789,
collectDomain: "https://xxxxxxx.pa-cd.com",
});
</script>
</head>
<body>
...
<script type="text/javascript">
pa.sendEvent(
"page.display", // Event name
{
page: "page name", // Event properties
page_chapter1: "level 1",
page_chapter2: "level 2",
page_chapter3: "level 3",
}
);
</script>
</body>
</html>
Before 6.16.0
<html>
<head lang="en">
<meta charset="UTF-8" />
<title>My Page</title>
<script
type="text/javascript"
crossorigin="anonymous"
src="https://tag.aticdn.net/piano-analytics.js"
></script>
<script type="text/javascript">
pa.setConfigurations({
// Basic configuration to send events
site: 123456789,
collectDomain: "https://<xxxxxxx>.pa-cd.com",
});
</script>
</head>
<body>
...
<script type="text/javascript">
pa.sendEvent(
"page.display", // Event name
{
page: "page name", // Event properties
page_chapter1: "level 1",
page_chapter2: "level 2",
page_chapter3: "level 3",
}
);
</script>
</body>
</html>

What this tracking captures:

ComponentValuePurpose
Eventpage.displayIdentifies this as a page view
Propertiespage: Page namePrimary page identifier
page_chapter1-3: Navigation hierarchyPage categorization for reporting

💡 Key insights from this data:

  • Most popular pages and content
  • Navigation patterns and user flows
  • Content performance by category
  • Site structure effectiveness

For complete setup instructions, see the JavaScript SDK guide.

Example 2: Tracking User Interactions

Beyond page views, you'll want to measure how users interact with your content. Here's how to track clicks with contextual information about where they occurred:

<html>
<head lang="en">
<meta charset="UTF-8" />
<title>My Page</title>
<script>
(function (_config) {
var script = document.createElement("script");
script.src = "https://tag.aticdn.net/piano-analytics.js";
script.async = true;
script.crossorigin = "anonymous";
script.dataset.config = JSON.stringify(_config);
document.head.appendChild(script);
})({
site: 123456789,
collectDomain: "https://xxxxxxx.pa-cd.com",
});
</script>
</head>
<body>
<button>My button</button>

<script type="text/javascript">
const button = document.querySelector("button");

button.addEventListener("click", (event) => {
pa.sendEvent(
"click.navigation", // Event name
{
click: "click name", // Event properties
click_chapter1: "click level 1",
click_chapter2: "click level 2",
click_chapter3: "click level 3",
page: "page name",
}
);
});
</script>
</body>
</html>

What this tracking captures:

ComponentValuePurpose
Eventclick.navigationIdentifies this as a navigation click
Propertiesclick: Click nameWhat element was clicked
click_chapter1-3: Click categorizationClassification of the click type
page: Page contextWhere the click occurred

💡 Key insights from this data:

  • Most engaged content and features
  • User interface effectiveness
  • Navigation patterns and preferences
  • Conversion funnel optimization opportunities