
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@sitecore-cloudsdk/events
Advanced tools
© Sitecore Corporation A/S. All rights reserved. Sitecore© is a registered trademark of Sitecore Corporation A/S.
© Sitecore Corporation A/S. All rights reserved. Sitecore© is a registered trademark of Sitecore Corporation A/S.
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.
To use the Sitecore Cloud SDK, you need:
npm install @sitecore-cloudsdk/events
init()
function.pageView()
- send a VIEW event.identity()
- send an IDENTITY event.form()
- send a FORM event (browser-side only).event()
- send a custom event.Capture and send a VIEW event from the browser side:
"use client";
import { useEffect } from "react";
import { init, pageView } from "@sitecore-cloudsdk/events/browser";
export default function Home() {
useEffect(() => {
initEvents();
}, []);
const initEvents = async () => {
await init({
sitecoreEdgeContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID || "",
siteName: process.env.NEXT_PUBLIC_SITENAME || "",
enableBrowserCookie: true,
});
console.log(`Initialized "@sitecore-cloudsdk/events/browser".`);
};
const sendPageViewEvent = async () => {
let eventData: any = {
channel: "WEB",
currency: "EUR",
};
let extensionData: any = {
customKey: "customValue",
};
await pageView(eventData, extensionData);
console.log("Sent VIEW event.");
};
return (
<div>
<button onClick={sendPageViewEvent}>send VIEW event</button>
</div>
);
}
Capture and send a VIEW event from the server side:
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
import { init, pageView } from "@sitecore-cloudsdk/events/server";
export async function middleware(req: NextRequest) {
const res = NextResponse.next();
await init(
{
sitecoreEdgeContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID || "",
siteName: process.env.NEXT_PUBLIC_SITENAME || "",
enableServerCookie: true,
},
req,
res
);
console.log(`Initialized "@sitecore-cloudsdk/events/server".`);
let eventData: any = {
channel: "WEB",
currency: "EUR",
};
let extensionData: any = {
customKey: "customValue",
};
const pageViewRes = await pageView(eventData, req, extensionData);
console.log("Sent VIEW event.");
return res;
}
Coming soon.
The Sitecore Cloud SDK uses the Apache 2.0 license.
FAQs
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.
The npm package @sitecore-cloudsdk/events receives a total of 13,197 weekly downloads. As such, @sitecore-cloudsdk/events popularity was classified as popular.
We found that @sitecore-cloudsdk/events demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.