npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-sitecore-personalize

v1.0.3

Published

React Sitecore Personalize Module

Downloads

2

Readme

react-sitecore-personalize

React Sitecore Personalize Module

The Sitecore Personalize react module is a wrapper for Sitecore Boxever Direct Client Script allowing you to add this script to react based apps. Making it easier for you to get started Personalizing your react based apps and sending events to Sitecore Personalize.

Installation

npm install --save react-sitecore-personalize

or

yarn add react-sitecore-personalize

How to Use

initClientScript Function is used to add Sitecore Direct Client Script within Body tag. For more info. Parameters:

  • clientKey - Your Client Key.
  • cookieDomain - Your top level cookie domain of the website that is being integrated e.g ".example.com" and not "www.example.com".
  • apiEndpoint - Your API target endpoint specific to your data center region. Europe, United States, Asia Pacific
  • clientVersion - Client Versions the Release Notes JS Library provides the available versions.
  • pointOfSale - This is the pointOfSale configured for the tenant.
  • webFlowTarget - This is the path for the Amazon CloudFront Content Delivery Network (CDN) for Sitecore Personalize.
  • eventSettings - Common Event properties LogEvents: enable/disable console logs, Currency: Currency used in POS ex 'USD', Language: Language in use ex 'EN', Channel: The channel captured ex 'WEB'.
import { useEffect } from 'react'
import { initClientScript } from 'react-sitecore-personalize'

export default function MyApp({ Component, pageProps }: AppProps) {
...
    useEffect(()=>{
        initClientScript('[Your api clientKey]','[domain]','https://api.boxever.com/v1.2','1.4.6','[your point of sale]','https://d1mj578wat5n4o.cloudfront.net', {LogEvents:true,Currency:'USD',Language:'EN',Channel:'WEB'})
    })
...
}

sendViewEvent - Function Sends View event to Sitecore Personalize for more info. Parameters:

  • page - The name of the webpage the guest visited.

sendAddEvent - Function Sends ADD event to Sitecore Personalize for more info. Parameters:

  • page - The name of the webpage the guest visited. Required.
  • productType - The type of product added to cart. Required
  • itemId - The item id of the product added to cart. Required.
  • productName - The name of the product added to the cart. Required.
  • productId - The product ID of the product added. Used in analytics for reporting. Required.
  • orderDate - The date and time the product was ordered. Required.
  • qty - The number of unit added. Total price of the product is calculated by unit price multiplied by quantity. Required
  • price - The unit price of the product.

sendConfirmEvent Function Sends CONFIRM order event for more info. Parameters:

  • page - The name of the webpage the guest visited. Required.
  • orderItems - array containing a list of item_id objects to be confirmed, where item_id maps to the productId to be confirmed, for example: lineItems.map(lineitem => ({item_id:lineitem.productId}). Required

sendCheckoutEvent Function Sends CHECKOUT event to Sitecore Personalize for more info. Parameters:

  • page - The name of the webpage the guest visited. Required.
  • orderReferenceId - The reference of the order. Required.
  • orderStatus - The status of the order. Required.

sendPaymentEvent Function Sends PAYMENT event using Direct Client Script, for more info. Parameters:

  • page - The name of the webpage the guest visited.
  • paymentType - The method of payment associated with a checkout.

sendIdentityByEmailEvent Sends IDENTITY event using Direct Client Script
email provider for more info. Parameters:

  • page - The name of the webpage the guest visited. Required
  • email - The email address of the guest. Required
  • title - The title of the guest. Optional
  • firstName - The first name of the guest. Optional
  • lastName - The last name of the guest. Optional
  • gender - The gender of the guest. Optional
  • dob - The date of birth of the guest. Optional
  • mobile - The mobile number of the guest. Optional
  • phone - The phone number of the guest. Optional
  • street - The street address of the guest. Optional
  • city - The city address of the guest. Optional
  • state - The state address of the guest. Optional
  • country - The country address of the guest. Optional
  • postalCode - The postal code of the guest. Optional

sendSearchEvent Function Sends SEARCH event using Direct Client Script for more info. Parameters:

  • page - The name of the webpage the guest visited.
  • productName - The product name the guest searched for.
  • productType - The product type the guest searched for.