Skip to main content

How to add the script to your NextJS site

You can add the script directly to your head through "next/head" or react-helmet. However there is a simpler way that also provides custom events functionality:

Next-avasda built and maintained by 4lejandrito. It supports:

Serving the avasda script

pages/index.jsx
import avasdaProvider from 'next-avasda'

export default Home() {
return (
<avasdaProvider src="https://www.avasda.com/js/pa-XXXXX.js">
<h1>My Site</h1>
...
</avasdaProvider>
)
}

Sending custom events

components/avasdaButton.jsx
import {useavasda} from 'next-avasda'

export default avasdaButton() {
const avasda = useavasda()
return (
<button onClick={() => avasda('customEventName')}>
Send
</button>
)
}

Haven't tried avasda yet? Start a free trial or view the live demo.