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

scrivito-neoletter-tracking

v0.2.1

Published

A set of Scrivito components and widgets for tracking capabilities.

Downloads

6

Readme

Scrivito Neoletter Tracking

Scrivito Neoletter Tracking library documentation. This guide provides detailed descriptions and usage instructions for each component and widgets available in the library. Our components and widgets are designed to provide tracking ability to the Scrivito based application.


Table of Contents


Installation

Install the package into your scrivito app:

npm install scrivito-neoletter-tracking

Initialization

Import the initNeoletterTrackingWidgets function from the package and call it in your index.js file found in the Widgets folder (e.g., in src/Widgets/index.js).

import { initNeoletterTrackingWidgets } from "scrivito-neoletter-tracking"

initNeoletterTrackingWidgets()

Import the loadEditingConfigs function from the package and call it in your editingConfigs.js file also found in the Widgets folder.

import { loadNeoletterTrackingWidgetsEditingConfigs } from "scrivito-neoletter-tracking"

loadNeoletterTrackingWidgetsEditingConfigs()

Add the widget styles to your app. This can be done by either loading the CSS via css-loader (e.g. in src/index.js or src/Widgets/index.js):

import "scrivito-neoletter-tracking/styles.css"

Or by importing the styles into your stylesheets (e.g. in src/assets/stylesheets/index.scss):

@import "scrivito-neoletter-tracking/styles.css";

To ensure that all components and widgets related to tracking can access and manage the cookie consent state effectively, it's crucial to wrap them with the NeoletterTrackingProvider Component. Typically, this setup should be implemented in your main application file, such as src/App.js.

Below is an example of how to integrate the NeoletterTrackingProvider along with the UnconnectedCookieConsentBanner component:

import { UnconnectedCookieConsentBanner, NeoletterTrackingProvider } from "scrivito-neoletter-tracking";

<HelmetProvider>
  <ErrorBoundary>
    <NeoletterTrackingProvider>
      <UnconnectedCookieConsentBanner />

      <CurrentPage />
      <ScrivitoNotFoundErrorPage>
        <NotFoundErrorPage />
      </ScrivitoNotFoundErrorPage>
    </NeoletterTrackingProvider>
  </ErrorBoundary>
</HelmetProvider>

NeoletterTrackingProvider Component

Description:
The NeoletterTrackingProvider component is essential for managing cookie consent state across the application.

CookieConsentBanner Component

Description:
The CookieConsentBanner component is designed for integration with Scrivito. It uses the getObj function to fetch content dynamically based on specified object attributes. This setup is perfect for scenarios where cookie consent information (such as titles, descriptions, and link details) is managed directly within the Scrivito, allowing content administrators to update information without requiring code changes.

If the cookie consent information does not need to be managed dynamically, consider using the UnconnectedCookieConsentBanner component instead. This alternative does not depend on Scrivito's getObj function, making it simpler and more straightforward for static content scenarios.

Properties:

  • getObj: Function to retrieve the Scrivito object - usually the root obj.
  • attributes: An object containing attribute keys for the object. These keys include:
    • title: (Optional) Attribute key for the title text.
    • description: (Optional) Attribute key for the description text.
    • link: (Optional) Attribute key for the "Learn more" link object.
    • declineConsentButtonTitle: (Optional) Attribute key for the decline button text.
    • acceptConsentButtonTitle: (Optional) Attribute key for the accept button text.
  • ref: Optional. React ref to attach to the component.
  • title: (Optional) The title of the banner, which can be a string or a React component.
  • description: (Optional) The description text explaining the storage usage, which can be a string or a React component.
  • consentLinkUrl: (Optional) URL for the "Learn more" link where users can get more detailed information about tracking.
  • consentLinkTitle: (Optional) The text to display for the "Learn more" link.
  • declineConsentButtonTitle: (Optional) The title for the decline button.
  • acceptConsentButtonTitle: (Optional) The title for the accept button.
  • onAccept: (Optional) Callback function that is called when the user accepts the tracking.
  • onDecline: (Optional) Callback function that is called when the user declines the tracking.

Example Usage:

import { CookieConsentBanner } from "scrivito-neoletter-tracking";

<CookieConsentBanner
  getObj={() => Scrivito.root()}
  attributes={{
    title: "cookieTitle",
    description: "cookieDescription",
    link: "cookiePolicyLink",
    declineConsentButtonTitle: "cookieDeclineButtonTitle",
    acceptConsentButtonTitle: "cookieAcceptButtonTitle"
  }}
  onAccept={() => console.log("Cookies accepted")}
  onDecline={() => console.log("Cookies declined")}
/>

UnconnectedCookieConsentBanner Component

Description:
UnconnectedCookieConsentBanner

Props:

  • title: (Optional) The title of the banner, which can be a string or a React component.
  • description: (Optional) The description text explaining the storage usage, which can be a string or a React component.
  • consentLinkUrl: (Optional) URL for the "Learn more" link where users can get more detailed information about tracking.
  • consentLinkTitle: (Optional) The text to display for the "Learn more" link.
  • declineConsentButtonTitle: (Optional) The title for the decline button.
  • acceptConsentButtonTitle: (Optional) The title for the accept button.
  • onAccept: (Optional) Callback function that is called when the user accepts the tracking.
  • onDecline: (Optional) Callback function that is called when the user declines the tracking.

Example Usage:

import { UnconnectedCookieConsentBanner } from "scrivito-neoletter-tracking";

<UnconnectedCookieConsentBanner
  title="Your Privacy"
  description="Our website stores information to enhance your experience. Please accept or decline the use of this information."
  consentLinkUrl="https://www.example.com/cookies-policy"
  consentLinkTitle="Learn more about tracking"
  declineConsentButtonTitle="Decline"
  acceptConsentButtonTitle="Accept"
  onAccept={() => console.log("Accepted")}
  onDecline={() => console.log("Declined")}
/>

Neoletter Tracking Widget

Description:
The TrackingWidget allows editor to integrate tracking tags into their applications. These tags are used to monitor visitor activities on the website. The widget is only visible in the editing environment, ensuring that it does not affect the normal visitor's experience on the production site.

Widget Attributes:

  • tags: A list of strings. Each string is a tag used for tracking purposes.

Usage: Simply add it into your page content in the Scrivito editing interface. You can then add tracking tags in the widget's configuration. These tags will be sent to Neoletter tracking service. To trigger tracking visitor has to spent at least one second on the page where the widgets has been provided.

Neoletter Campaign Widget

Description:
The CampaignWidget facilitates the management of campaign-specific content based on visitor tracking data. It allows editor to specify default content and conditional content that reactively changes based on the tracking data obtained during the visitor's sessions.

Widget Attributes:

  • defaultTag: A string that represents the default tracking tag used to determine the initial content displayed to visitors.
  • conditionalContent: A widget list specifically for CampaignConditionalContentWidget which adjusts content based on the real-time data and conditions defined.

Neoletter Campaign Conditional Content Widget

Description:
The CampaignConditionalContentWidget displays content conditionally based on tracking tags associated with user activity.

Widget Attributes:

  • tag: A string that represents a tracking tag associated with specific content.
  • content: A widgetlist that holds the content to be displayed if the conditions associated with the tag are met.

Usage: Add it inside a CampaignWidget. Configure the tag attribute to match the tracking tags that identify different visitor tracking criteria. Content placed in the content attribute will only be displayed if the conditions specified by the tag are met, providing a dynamic and personalized user experience.