Skip to content

Commit

Permalink
docs: add extract cookie example
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jul 26, 2022
1 parent 22eb48b commit 47d24c4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions apps/docs/docs/editor/blocks/logic/set-variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,20 @@ window.location.href
It will not give you the parent URL if you embed the bot on your site.
A more bulletproof option is to pass the URL as a hidden variable in the embed code options. You can find an example [here](/embed/html-javascript#additional-configuration).
:::

## Extract a cookie

This code allows you to extract the value of a cookie called "my_cookie":

```js
const getCookie = (name) => {
const value = `; ${document.cookie}`
const parts = value.split(`; ${name}=`)
if (parts.length === 2) return parts.pop().split(';').shift()
return 'not found'
}

return getCookie('my_cookie')
```

As you can see the code can also be multi-line. The Set variable block will get the value following the `return` statement.

4 comments on commit 47d24c4

@vercel
Copy link

@vercel vercel bot commented on 47d24c4 Jul 26, 2022

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 47d24c4 Jul 26, 2022

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.vercel.app
docs-git-main-typebot-io.vercel.app
docs.typebot.io

@vercel
Copy link

@vercel vercel bot commented on 47d24c4 Jul 26, 2022

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-alpha – ./apps/viewer

bot.aws.bj
vhpage.cr8.ai
247987.com
8jours.top
am.nigerias.io
bt.id8rs.com
finplex.be
bot.aipr.kr
an.nigerias.io
sat.cr8.ai
ar.nigerias.io
apo.nigerias.io
bot.lalmon.com
aso.nigerias.io
games.klujo.com
chat.sureb4.com
sakuranembro.it
ticketfute.com
apr.nigerias.io
eventhub.com.au
bot.upfunnel.art
bot.piccinato.co
faqs.nigerias.io
feedback.ofx.one
voicehelp.cr8.ai
kw.wpwakanda.com
stan.vselise.com
clo.closeer.work
app.chatforms.net
bot.agfunnel.tech
bot.maitempah.com
fmm.wpwakanda.com
bot.phuonghub.com
k1.kandabrand.com
gentleman-shop.fr
ov1.wpwakanda.com
lb.ticketfute.com
ov3.wpwakanda.com
1988.bouclidom.com
ov2.wpwakanda.com
this-is-a-test.com
goalsettingbot.com
zap.techadviser.in
order.maitempah.com
bot.digitalbled.com
carsalesenquiry.com
bot.eventhub.com.au
forms.webisharp.com
typebot.stillio.com
bium.gratirabbit.com
bot.ansuraniphone.my
bot.cotemeuplano.com
chat.hayurihijab.com
aidigitalmarketing.kr
abutton.wpwakanda.com
bbutton.wpwakanda.com
get.freebotoffer.xyz
connect.growthguy.in
bot.incusservices.com
bot.meuesocial.com.br
chat.missarkansas.org
cdd.searchcube.com.sg
sbutton.wpwakanda.com
bbutton.wpwwakanda.com
form.searchcube.com.sg
felipewelington.com.br
apply.ansuraniphone.my
c23111azqw.nigerias.io
gcase.barrettamario.it
info.clickasuransi.com
report.gratirabbit.com
kodawariab736.skeep.it
83242573.actualizar.xyz
resume.gratirabbit.com
bot.upgradesolutions.eu
bot.blackboxtips.com.br
view.onlinebotdemo.xyz
signup.hypemarketing.in
mainmenu.diddancing.com
subfooter.wpwakanda.com
91181264.your-access.one
survey.hypemarketing.in
type.opaulovieira.com.br
aibot.angrybranding.co.uk
hunterbot.saleshunter.ai
bot.aidigitalmarketing.kr
form.sergiolimajr.com.br
bot.blackboxsports.com.br
bot.cabinrentalagency.com
boyfriend-breakup.riku.ai
chat.thisiscrushhouse.com
sellmyharleylouisiana.com
presente.empresarias.com.mx
type.dericsoncalari.com.br
designguide.techyscouts.com
verfica.botmachine.com.br
piazzatorre.barrettamario.it
onboarding.libertydreamcare.ie
sell.sellthemotorhome.co.uk
type.talitasouzamarques.com.br

@vercel
Copy link

@vercel vercel bot commented on 47d24c4 Jul 26, 2022

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-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app
app.typebot.io

Please sign in to comment.