Web SDK Documentation

Essentials for installing and using the Ours Privacy Web SDK, including event tracking and user identification.

Ours Privacy Web SDK Documentation

This guide covers the essentials for getting started with the Ours Privacy Web SDK. Below you'll find instructions for installing the SDK in your website's <head>, tracking events, and identifying users.


Installation

To ensure that all page events are captured accurately, include the SDK script in the <head> section of your HTML:

<head>
  <!-- Other head elements -->
  <!-- Insert copy/pasted Ours Privacy Script Here -->
</head>

Note: Installing the SDK in the <head> ensures that events occurring as soon as the page loads are tracked properly.


Tracking Events

Once the SDK is installed and initialized, you can start tracking events on your website using the ours('track', ...) method.

Example

Track a custom event with properties and context:

ours('track', 'event name', { value: 1 }, { first_name: 'test' });

  • Event Name: "event name" – Replace with the actual name of your event.
  • Event Properties: { value: 1 } – Contains metrics or values related to the event.
  • User Properties: { first_name: 'test' } – Provides additional user properties. Please see allowed user properties.

This function call sends the event data to Ours Privacy for further processing and analysis.


Identifying Users

To associate tracked events with a specific user, use the ours('identify', ...) method. This method helps in linking the user's actions across sessions and devices.

Example

Identify a user by setting their properties:

ours('identify', { first_name: 'test' });

  • User Properties: { first_name: 'test' } – Customize this with user-specific properties such as first name, email or external ID.

By identifying users, you enhance the quality of your analytics and ensure a more personalized user tracking experience.


Summary

  • Installation:
    Place the SDK script in your <head> and initialize it with your account details.

  • Tracking Events:
    Use ours('track', 'event name', eventProperties, userProperteis) to capture and send event data.

  • User Identification:
    Use ours('identify', { userProperties }) to link events with specific user profiles. Please see allowed user properties.

With these steps, you can efficiently integrate the Ours Privacy Web SDK into your website and start capturing valuable insights. For additional details and advanced configurations, please refer to the related guides in the sidebar.