GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - unifygtm/intent-react: Library for using the Unify Intent JS Client in a React app.

BranchesTags
Open more actions menu

Latest commit

 

History

23 Commits
23 Commits

Folders and files

NameName
Last commit message
Last commit date
.vscode
.vscode
 
 
src
src
 
 
.eslintrc.json
.eslintrc.json
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
README.md
README.md
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
prettier.config.js
prettier.config.js
 
 
tsconfig.json
tsconfig.json
 
 
tslint.json
tslint.json
 
 

Repository files navigation

Unify Intent React

Library for using the Unify Intent JS Client in a React app.

Installation

npm

npm install @unifygtm/intent-react

yarn

yarn add @unifygtm/intent-react

Usage

Wrap your React app in a UnifyIntentProvider:

import {
  UnifyIntentClient,
  UnifyIntentClientConfig,
  UnifyIntentProvider
} from '@unifygtm/intent-react';

const writeKey = 'YOUR_PUBLIC_API_KEY';

const config: UnifyIntentClientConfig = {
  autoPage: true,
  autoIdentify: false,
};

const intentClient = new UnifyIntentClient(writeKey, config);

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement,
);

root.render(
  <UnifyIntentProvider intentClient={intentClient}>
    <App />
  </UnifyIntentProvider>
);

Then, any components rendered in your app can access the intent client using the useUnifyIntent hook:

import { useUnifyIntent } from '@unifygtm/intent-react';

const SomeComponent = () => {
  // However you access the current user...
  const currentUser = useCurrentUser();

  const unify = useUnifyIntent();

  useEffect(() => {
    // Log an identify event for the current user
    unify.identify(currentUser.emailAddress);
  }, [currentUser.emailAddress]);
};

About

Library for using the Unify Intent JS Client in a React app.

Resources

Readme
Activity
Custom properties

Stars

10 stars

Watchers

6 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.