Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sitecore-cloudsdk/events

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sitecore-cloudsdk/events

This package provides browser- and server-side functions to ​capture events in your app and send them to Sitecore. Events are for collecting behavioral data about your users as they interact with your app.

  • 0.4.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
7.6K
decreased by-61.54%
Maintainers
0
Weekly downloads
 
Created
Source

events

This package provides browser- and server-side functions to ​capture events in your app and send them to Sitecore. Events are for collecting behavioral data about your users as they interact with your app.

Installation

npm install @sitecore-cloudsdk/events

Usage

  1. Initialize the package using the CloudSDK function, available in the core package.
  2. Send events using the following functions:
    • pageView - send a VIEW event.
    • identity - send an IDENTITY event.
    • form - send a FORM event (browser-side only).
    • event - send SC_SEARCH events, other standard events, or a custom event.

Code examples

Capture and send a VIEW event from the browser side:

'use client';

import { useEffect } from 'react';
import { CloudSDK } from '@sitecore-cloudsdk/core/browser';
import { pageView } from '@sitecore-cloudsdk/events/browser';

export default function Home() {
  useEffect(() => {
    CloudSDK({
      /* Initialization settings. See `core` package code examples. */
    })
      .addEvents()
      .initialize();

    // Send VIEW event:
    pageView();
  }, []);

  return <></>;
}

Capture and send a VIEW event from the server side:

import type { NextRequest, NextResponse } from 'next/server';
import { CloudSDK } from '@sitecore-cloudsdk/core/server';
import { pageView } from '@sitecore-cloudsdk/events/server';

export async function middleware(request: NextRequest) {
  const response = NextResponse.next();

  await CloudSDK(request, response, {
    /* Initialization settings. See `core` package code examples. */
  })
    .addEvents()
    .initialize();

  // Send VIEW event:
  await pageView(request);

  return response;
}

Documentation

Official Sitecore Cloud SDK documentation

FAQs

Package last updated on 09 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc