Framework Guides

Sitecore

Install the Ours Privacy Web SDK on Sitecore using an SXA HTML snippet, a layout view, or the head of an XM Cloud front end.

Use this page to install the Ours Privacy Web SDK on a Sitecore site.

Where the snippet goes depends on which Sitecore setup you run. All three paths below produce the same result, so identify your setup first and follow only that section.


Steps to Integrate Ours Privacy with Sitecore

1. Copy your install snippet

Copy your install snippet from the Install Ours page.

2. Add the snippet for your Sitecore setup

Sitecore Experience Accelerator (SXA)

SXA sites can add head markup without a code deployment. Add an HTML snippet to the shared page layout so it renders on every page. Because the markup is content rather than code, a marketer with the right permissions can make this change. Sitecore documents the available renderings in their SXA documentation.

Sitecore XP or XM with MVC or ASP.NET Core

Add the snippet to the shared layout view that renders your site's <head>, then deploy through your normal pipeline:

<!-- your shared layout view -->
<head>
  <!-- Ours Pixel Code -->
  <script>
    // your install code is here
  </script>
  <!-- End Ours Pixel Code -->
</head>

Sitecore XM Cloud

XM Cloud renders through a separate front-end application, usually Next.js. The snippet belongs in that application rather than in Sitecore. Follow the Next.js guide, and see Tracking page views in single-page apps for client-side navigation.

3. Deploy and verify

  1. Publish or deploy, depending on which path you used.
  2. Load a published page and view the page source to confirm the snippet is present.
  3. Open the browser console to check for script errors.
  4. In your Ours Privacy account, check Recent Events to confirm page views are arriving.

Important: Sitecore caches rendered output aggressively. If the snippet does not appear in the page source, clear the relevant caches and republish before assuming the change did not apply.


Track Custom Events

Call ours('track', ...) from a rendering or a client-side script:

ours('track', 'Form Submitted', { form_name: 'contact_us' });

Next Steps

If you need further assistance, contact us at support@oursprivacy.com.

How is this guide?

On this page