@foomo/sesamy
v0.1.5
Published
Server Side Tagging System (Sesamy)
Downloads
354
Keywords
Readme
@foomo/sesamy
Server Side Tag Management System
Usage
Load gtm.js
and setup window.gtag()
:
import { GTMScript } from '@foomo/sesamy';
export default function RootLayout({ children }: Layout) {
return (
<html lang="en">
<head>
<GTMScript id={'GTM-XXXXXXX'} />
</head>
<body>
<main>{children}</main>
</body>
</html>
);
}
Send event:
import { collect } from '@foomo/sesamy';
export const MyComponent = () => {
const handleClick = () => {
collect({
name: 'my-event',
params: {
value: 'my-value'
}
})
}
return (<button onClick={handleClick}>Click</button>)
}
Code generation
If you're using Go, checkout foomo/sesamy-cli to generate events to keep your backend, frontend and Google Tag Manager in sync.
How to Contribute
Make a pull request...
This repo uses Changeset, so please run this on your PR and follow the instructions:
$ pnpm changeset
License
Distributed under MIT License, please see license file within the code for more details.