CDPGuidesSupport

Ours Privacy Web SDK

Discover how to install and configure the Ours Privacy Web SDK to track events, collect visitor data, and create separate sources for your web properties.

The Ours Privacy Web SDK is a lightweight JavaScript library that tracks events and collects visitor data directly from your website. This script is a primary source for capturing first-party data and sending it to Ours Privacy for processing and distribution.

The Ours Privacy Tag Manager uses the Web SDK under the hood.


Why Use the Web SDK?

The Web SDK is designed to:

  • Automatically Collect Important Data Across Page Views:
    • Collect visitor data such as UTM parameters, IP address, referrer, and device details.
  • Track Custom Events:
    • Send events like form submissions, clicks, or page views with additional properties.
  • Separate Data by Source:
    • Organize and differentiate data from multiple web properties, enabling precise tracking and reporting.
  • Support Your Privacy Program:
    • Hash or redact fields per destination to support HIPAA and other privacy requirements.

Installing the Ours Privacy Web SDK

Note:

  • All Ours Privacy accounts come with a Web SDK token enabled.
  • You can create more than one Web SDK source if you need to track multiple websites that trigger differing destinations
  • You can add allowed domains to a Web SDK source to block unwanted requests

Features of the Web SDK

1. Default Data Collection

The Web SDK automatically collects:

  • Ad Tracking Parameters: gclid, fbclid, utm_*, and other campaign identifiers.
  • Visitor Metadata: Browser type, operating system, screen resolution, and IP address.
  • Page Details: Referrer, current URL, and title.

2. Custom Event Tracking

Track specific interactions using the ours('track', 'ButtonClick') function:

ours('track', 'ButtonClick');

3. User Property Identification

Associate user-specific properties with visitors using the ours('identify') function:

ours('identify', { email: 'user@example.com' });

4. Source Segmentation

If you manage multiple web properties, Ours Privacy lets you set up separate sources for each property. This ensures data is isolated and reported accurately. Sources also allow you to configure different destinations or mappings for each property.

You can also allow domains for each Web SDK source you setup. And, enable/disable them at anytime.


Debugging the Web SDK

If the Web SDK is not tracking events as expected:

  1. Verify Installation:
    • Confirm the script is in the <head> section of your website.
  2. Check the Dashboard:

Privacy and Compliance

Ours Privacy signs Business Associate Agreements with healthcare organizations, and Data Mapping controls which fields each destination receives hashed, redacted, or omitted. See Data Access and Privacy.


Best Practices for Using the Web SDK

  1. Place the Script in the<head> :
    • Ensure the script loads before any user interaction occurs.
  2. Use Sources for Multiple Properties:
    • Set up separate sources for each web property to manage data independently.
  3. Track Key Events:
    • Identify important events (e.g., page_view, Purchase) and ensure they are tracked consistently.
  4. Minimize Sensitive Data:
    • Use identify sparingly and hash sensitive fields like email where possible.
  5. Monitor Data:
    • Regularly review collected events in the dashboard to verify accuracy and compliance.

Next Steps

How is this guide?

On this page