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

@sitecore-cloudsdk/events

Package Overview
Dependencies
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sitecore-cloudsdk/events - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

2

dist/cjs/package.json
{
"name": "@sitecore-cloudsdk/events",
"version": "0.1.2",
"version": "0.1.3",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "exports": {

{
"name": "@sitecore-cloudsdk/events",
"version": "0.1.2",
"version": "0.1.3",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "exports": {

{
"name": "@sitecore-cloudsdk/events",
"version": "0.1.2",
"version": "0.1.3",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "exports": {

@@ -5,10 +5,9 @@ # 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 and transactional data about your users as they interact with your app.
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.
## Prerequisites
To use the Sitecore Cloud SDK, you need:
To use the Sitecore Cloud SDK, you need an XM Cloud project. This project has to be created from the [XM Cloud foundation template](https://github.com/sitecorelabs/xmcloud-foundation-head) and deployed on XM Cloud.
- A Next.js 13 app deployed on Sitecore XM Cloud.
- An XM Cloud Plus subscription.
The foundation template contains an XM Cloud JSS Next.js app. You use the Sitecore Cloud SDK in this app. To be able to use the Sitecore Cloud SDK, you need JSS version 21.6.0 or newer.

@@ -32,8 +31,16 @@ ## Installation

---
**NOTE**
These code examples illustrate how the Sitecore Cloud SDK works in a standalone Next.js app. In production, you implement Sitecore Cloud SDK functionality differently, in a JSS Next.js app. See code examples for that environment in the official documentation.
---
Capture and send a VIEW event from the browser side:
```ts
"use client";
import { useEffect } from "react";
import { init, pageView } from "@sitecore-cloudsdk/events/browser";
'use client';
import { useEffect } from 'react';
import { init, pageView } from '@sitecore-cloudsdk/events/browser';

@@ -47,4 +54,4 @@ export default function Home() {

await init({
sitecoreEdgeContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID || "",
siteName: process.env.NEXT_PUBLIC_SITENAME || "",
sitecoreEdgeContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID || '',
siteName: process.env.NEXT_PUBLIC_SITENAME || '',
enableBrowserCookie: true,

@@ -58,8 +65,8 @@ });

let eventData: any = {
channel: "WEB",
currency: "EUR",
channel: 'WEB',
currency: 'EUR',
};
let extensionData: any = {
customKey: "customValue",
customKey: 'customValue',
};

@@ -69,3 +76,3 @@

console.log("Sent VIEW event.");
console.log('Sent VIEW event.');
};

@@ -84,5 +91,5 @@

```ts
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
import { init, pageView } from "@sitecore-cloudsdk/events/server";
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
import { init, pageView } from '@sitecore-cloudsdk/events/server';

@@ -94,4 +101,4 @@ export async function middleware(req: NextRequest) {

{
sitecoreEdgeContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID || "",
siteName: process.env.NEXT_PUBLIC_SITENAME || "",
sitecoreEdgeContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID || '',
siteName: process.env.NEXT_PUBLIC_SITENAME || '',
enableServerCookie: true,

@@ -106,8 +113,8 @@ },

let eventData: any = {
channel: "WEB",
currency: "EUR",
channel: 'WEB',
currency: 'EUR',
};
let extensionData: any = {
customKey: "customValue",
customKey: 'customValue',
};

@@ -117,3 +124,3 @@

console.log("Sent VIEW event.");
console.log('Sent VIEW event.');

@@ -126,6 +133,6 @@ return res;

Coming soon.
[Official Sitecore Cloud SDK documentation](https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-cloud-sdk.html)
### License
The Sitecore Cloud SDK uses the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0).
The Sitecore Cloud SDK uses the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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