NextJS 13 Wrapper for fb pixel and capi for graph v17.0 API
npm install @vizertech/nextjs-capiNPM
``bash`
npm install @vizertech/nextjs-capi
Yarn
`bash`
yarn add @vizertech/nextjs-capi
`jsx
import { fbEventsHandler } from '@vizertech/nextjs-capi';
export default fbEventsHandler;
`
`dotenv`
FB_ACCESS_TOKEN=accessToken
NEXT_PUBLIC_GRAPH_VERSION=v17.0
NEXT_PUBLIC_PIXEL_ID=pixelId
NEXT_PUBLIC_DEBUG=true
jsx
import { FBPixelScript, FBPixelProvider } from '@vizertech/nextjs-capi';<>
>
`3. Envia los eventos desde cualquiero parte de tu aplicacion, usando los typings adecuados para cada evento
`jsx
import { fbEvent } from '@vizertech/nextjs-capi';//use on client side effect and browser event handlers only
fbEvent({
event_name: '',
event_time: 24234423, //unix time
action_source: "website", //TODO: ver que valores son estos,
event_id?: '',
event_source_url: 'https://...',
currency: 'mxn',
custom_data?: {
content_type?: 'product_group',
currency?: 'MXN',
value?: 100,
contents?: [
{ id: 1, quantity: 1, item_price: 100 }
]
},
user_data: {
client_ip_address: '',
ct?: [''], //hash
external_id?: [''], //hash
fn?: [''], //hash
ph?: [''], //hash
zp?: [''], //hash
client_user_agent: [''], //hash
st?: [''], //hash
country?: [''], //hash
em?: [''], //hash
fbc?: '',
fbp?: ''
},
test_event_code?: '' //SEND ONLY FOR TEST EVENTS MODE
});
``