# Capture cookie value in synthetic script step (to set in following step)

**URL:** <https://community.dynatrace.com/t/capture-cookie-value-in-synthetic-script-step-to-set-in-following-step/32244>\
**Category:** Synthetic Monitoring\
**Tags:** browser-monitors, synthetic-monitoring\
**Created:** [July 29, 2021, 10:35am UTC](https://community.dynatrace.com/t/capture-cookie-value-in-synthetic-script-step-to-set-in-following-step/32244 "2021-07-29T10:35:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [July 29, 2021, 10:35am UTC](https://community.dynatrace.com/t/capture-cookie-value-in-synthetic-script-step-to-set-in-following-step/32244/1 "2021-07-29T10:35:35Z")

</div>

Hello,

It looks like the dynatrace synthetic script does not keep cookie’s an values between steps. I have noticed that you can define cookies using an event. It would be nice if the value from a previous step could be used here.

In first steps I login, a session cookie is used. And after the login in the next step a 400 (deceptive) request is send back. I mimicked this by removing the session cookie in the browser.

KR Henk

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [August 11, 2021, 8:37pm UTC](https://community.dynatrace.com/t/capture-cookie-value-in-synthetic-script-step-to-set-in-following-step/32244/2 "2021-08-11T20:37:13Z")

</div>

[@henk\_stobbe](https://community.dynatrace.com/user/11427)&nbsp;you might want to toss in a RFE so this feature can be built into the product

---

<div class="post-metadata">

**Author:** ![hannahmac](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@hannahmac](https://community.dynatrace.com/u/hannahmac)\
**Post date:** [August 13, 2021, 7:59am UTC](https://community.dynatrace.com/t/capture-cookie-value-in-synthetic-script-step-to-set-in-following-step/32244/3 "2021-08-13T07:59:18Z")

</div>

For Browser Monitors, I wouldn’t expect this to occur, once a Cookie is set I would expect it to persist for that execution.

For HTTP Monitors, I would expect the cookie to need to be set with each request and this can be done by pulling the session id and then adding it into the subsequent requests. There’s a similar example in the docs [here.](https://www.dynatrace.com/support/help/how-to-use-dynatrace/synthetic-monitoring/http-monitors/pre-and-post-scripting-for-http-monitors/#example-monitor)

If this is for a Browser Monitor, can you create a Support ticket for Dynatrace to investigate?
