Skip to content

Commit

Permalink
⚡ (pixel) Add skip initialization option
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jun 28, 2023
1 parent 033f8f9 commit 50fcbfd
Show file tree
Hide file tree
Showing 12 changed files with 817 additions and 271 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { TextLink } from '@/components/TextLink'
import { TextInput } from '@/components/inputs'
import { CodeEditor } from '@/components/inputs/CodeEditor'
import { Select } from '@/components/inputs/Select'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { Stack, Text } from '@chakra-ui/react'
import { isDefined, isEmpty } from '@typebot.io/lib'
import {
Expand All @@ -25,6 +26,12 @@ type Props = {
type Item = NonNullable<PixelBlock['options']['params']>[number]

export const PixelSettings = ({ options, onOptionsChange }: Props) => {
const updateIsInitSkipped = (isChecked: boolean) =>
onOptionsChange({
...options,
isInitSkip: isChecked,
})

const updatePixelId = (pixelId: string) =>
onOptionsChange({
...options,
Expand Down Expand Up @@ -77,6 +84,12 @@ export const PixelSettings = ({ options, onOptionsChange }: Props) => {
withVariableButton={false}
placeholder='Pixel ID (e.g. "123456789")'
/>
<SwitchWithLabel
label={'Skip initialization'}
moreInfoContent="Check this if the bot is embedded in your website and the pixel is already initialized."
initialValue={options?.isInitSkip ?? false}
onCheckChange={updateIsInitSkipped}
/>
<SwitchWithRelatedSettings
label={'Track event'}
initialValue={isDefined(options?.params)}
Expand Down
4 changes: 0 additions & 4 deletions apps/docs/docs/editor/blocks/integrations/ga.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ The Google Analytics integration block allows you to track a Google Analytics ev
alt="Google Analytics block"
/>

:::note
This block is not executed in Preview mode. To test it, you need to launch the published bot.
:::

When your flow contains a Google Analytics block, under the hood it:

- Initialize GA and track a "Page view" event on page load.
Expand Down
4 changes: 0 additions & 4 deletions apps/docs/docs/editor/blocks/integrations/pixel.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ The Pixel integration block allows you to add a Meta pixel to your bot and track
alt="Pixel block"
/>

:::note
This block is not executed in Preview mode. To test it, you need to launch the published bot.
:::

When your flow contains a pixel block, under the hood it:

- Initialize the pixel and track "PageView" event on page load.
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/docs/editor/settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ You can tweak `3000` (3s) to your liking.

In the Metadata section, you can customize how the preview card will look if you share your bot URL on social media for example.

You can also add some custom head code to add third-party scripts like a Facebook pixel for example.
You can also add some custom head code to add third-party scripts.

### Google Tag Manager

Expand Down
22 changes: 22 additions & 0 deletions apps/docs/docs/embed/html-javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,28 @@ typebot-bubble::part(preview-message) {
}
```

## Callbacks

If you need to trigger events on your parent website when the user interact with the bot, you can use the following callbacks:

```js
Typebot.initStandard({
typebot: 'my-typebot',
onNewInputBlock: (inputBlock) => {
console.log('New input block displayed', inputBlock.id)
},
onAnswer: (answer) => {
console.log('Answer received', answer.message, answer.blockId)
},
onInit: () => {
console.log('Bot initialized')
},
onEnd: () => {
console.log('Bot ended')
},
})
```

## Additional configuration

You can prefill the bot variable values in your embed code by adding the `prefilledVariables` option. Here is an example:
Expand Down
167 changes: 167 additions & 0 deletions apps/docs/openapi/builder/_spec_.json
Original file line number Diff line number Diff line change
Expand Up @@ -3402,6 +3402,170 @@
"webhookId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"groupId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"Pixel"
]
},
"options": {
"anyOf": [
{
"type": "object",
"properties": {
"pixelId": {
"type": "string"
},
"isInitSkip": {
"type": "boolean"
},
"params": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"key": {
"type": "string"
},
"value": {}
},
"required": [
"id"
],
"additionalProperties": false
}
},
"eventType": {
"not": {}
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"pixelId": {
"type": "string"
},
"isInitSkip": {
"type": "boolean"
},
"params": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"key": {
"type": "string"
},
"value": {}
},
"required": [
"id"
],
"additionalProperties": false
}
},
"eventType": {
"type": "string",
"enum": [
"Lead",
"Contact",
"CompleteRegistration",
"Schedule",
"SubmitApplication",
"ViewContent",
"AddPaymentInfo",
"AddToCart",
"AddToWishlist",
"CustomizeProduct",
"Donate",
"FindLocation",
"InitiateCheckout",
"Purchase",
"Search",
"StartTrial",
"Subscribe"
]
}
},
"required": [
"eventType"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"pixelId": {
"type": "string"
},
"isInitSkip": {
"type": "boolean"
},
"params": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"key": {
"type": "string"
},
"value": {}
},
"required": [
"id"
],
"additionalProperties": false
}
},
"eventType": {
"type": "string",
"enum": [
"Custom"
]
},
"name": {
"type": "string"
}
},
"required": [
"eventType"
],
"additionalProperties": false
}
]
}
},
"required": [
"id",
"groupId",
"type",
"options"
],
"additionalProperties": false
}
]
}
Expand Down Expand Up @@ -3568,6 +3732,9 @@
"schema": {
"type": "object",
"properties": {
"icon": {
"type": "string"
},
"name": {
"type": "string"
}
Expand Down
Loading

4 comments on commit 50fcbfd

@vercel
Copy link

@vercel vercel bot commented on 50fcbfd Jun 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2 – ./apps/viewer

bot.leadbooster.help
bot.mycompay.reviews
bot.socialcliques.me
chat.gnipharmahq.com
chat.hayurihijab.com
chatbee.agfunnel.com
click.sevenoways.com
connect.growthguy.in
forms.bonanza.design
hello.advergreen.com
kuiz.sistemniaga.com
malayanboosterhq.com
menukb.wpwakanda.com
prenota.aldoemaria.it
revistasaudeemdia.com
sbutton.wpwakanda.com
talk.convobuilder.com
test.leadbooster.help
whats.laracardoso.com
zillabot.saaszilla.co
815639944.21000000.one
83720273.bouclidom.com
aplicacao.bmind.com.br
apply.ansuraniphone.my
bbutton.wpwwakanda.com
bolsamaisbrasil.app.br
bot.clubedotrader.club
bot.ilmuseoaiborghi.it
bot.louismarcondes.com
bot.pratikmandalia.com
bot.t20worldcup.com.au
bot2.mycompany.reviews
bot3.mycompany.reviews
bot4.mycompany.reviews
c23111azqw.nigerias.io
chat.footballmeetup.ie
dieta.barrettamario.it
felipewelington.com.br
form.bridesquadapp.com
form.searchcube.com.sg
gcase.barrettamario.it
help.giversforgood.com
info.clickasuransi.com
kodawariab736.skeep.it
michaeljackson.riku.ai
premium.kandabrand.com
report.gratirabbit.com
resume.gratirabbit.com
83242573.actualizar.xyz
87656003.actualizar.xyz
88152257.actualizar.xyz
91375310.actualizar.xyz
app.youvisitedthis.site
arrivalx2.wpwakanda.com
bot.blackboxtips.com.br
bot.hotelplayarimini.it
bot.upgradesolutions.eu
chat.bebesemcolicas.com
filial.socialcliques.me
help.comebackreward.com
link.venturasuceder.com
upload.atlasoutfittersk9.com
atendimento.martinarod.online
bot.brigadeirosemdrama.com.br
mdb.eventoequipe.progenbr.com
tuttirecepcao.fratucci.com.br
forms.escoladeautomacao.com.br
onboarding.libertydreamcare.ie
type.talitasouzamarques.com.br
agendamento.sergiolimajr.com.br
anamnese.clinicamegasjdr.com.br
bookings.littlepartymonkeys.com
bot.comercializadoraomicron.com
elevateyourmind.groovepages.com
viewer-v2-typebot-io.vercel.app
yourfeedback.comebackreward.com
baleia.testeeventos.progenbr.com
bot.cabin-rentals-of-georgia.net
chat.portaloficialautorizado.com
open.campus.bot.aalen.university
sondaggio.mosaicohairboutique.it
baleia.testegabinete.progenbr.com
chat.alfabetizacaobilingue.com.br
gerador.verificadordehospedes.com
personal-trainer.barrettamario.it
sondaggio.mosaicohairboutique.com
mdb.assessoria.ademir.progenbr.com
preagendamento.sergiolimajr.com.br
studiotecnicoimmobiliaremerelli.it
download.thailandmicespecialist.com
register.thailandmicespecialist.com
mdb.evento.equipeinterna.progenbr.com
bot.studiotecnicoimmobiliaremerelli.it
pesquisa.escolamodacomproposito.com.br
anamnese.clinicaramosodontologia.com.br
gabinete.baleia.formulario.progenbr.com
chrome-os-inquiry-system.itschromeos.com
viewer-v2-git-main-typebot-io.vercel.app
main-menu-for-itschromeos.itschromeos.com
mdb.assessoria.qrcode.ademir.progenbr.com

@vercel
Copy link

@vercel vercel bot commented on 50fcbfd Jun 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 50fcbfd Jun 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-typebot-io.vercel.app
builder-v2-git-main-typebot-io.vercel.app
app.typebot.io

@vercel
Copy link

@vercel vercel bot commented on 50fcbfd Jun 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs.typebot.io
docs-git-main-typebot-io.vercel.app
docs-typebot-io.vercel.app

Please sign in to comment.