# Possible to Script Values in Synthetics?

**URL:** <https://discuss.elastic.co/t/possible-to-script-values-in-synthetics/287602>\
**Category:** Beats\
**Tags:** heartbeat\
**Created:** [October 25, 2021, 3:45pm UTC](https://discuss.elastic.co/t/possible-to-script-values-in-synthetics/287602 "2021-10-25T15:45:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenB196](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benb196/32/83401_2.png) [@BenB196](https://discuss.elastic.co/u/BenB196)\
**Post date:** [October 25, 2021, 3:45pm UTC](https://discuss.elastic.co/t/possible-to-script-values-in-synthetics/287602/1 "2021-10-25T15:45:10Z")

</div>

Hi All,

I have a use case where I want to use synthetics to monitor a page, however this page has a URL which requires it to be updated daily with the days date. Kind of like: `http://url/<today's_day(2021-10-25)>`. Since it appears that synthetics accepts `.js` files for its sources. Does that mean regular JS can also be used within synthetics to do things like generate and modify values are run time, or is this not possible?

---

<div class="post-metadata">

**Author:** ![Dominique\_Clarke](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dominique_clarke/32/92223_2.png) [@Dominique\_Clarke](https://discuss.elastic.co/u/Dominique_Clarke)\
**Post date:** [October 25, 2021, 3:57pm UTC](https://discuss.elastic.co/t/possible-to-script-values-in-synthetics/287602/2 "2021-10-25T15:57:39Z")

</div>

Hi Ben. You absolute can include custom logic in your synthetic scripts to suit your needs.

For example, you can write a step to navigate to a page with dynamic values.

```auto
step('Navigate to page', async () => {
    const date = new Date();
    await page.goto(`http://${date.getMonth()}-${date.getDay()}-${date.getFullYear()}`);
});

```

We know that many production synthetics scripts will require this type of dynamic logic. Hope this helps.

---

<div class="post-metadata">

**Author:** ![BenB196](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benb196/32/83401_2.png) [@BenB196](https://discuss.elastic.co/u/BenB196)\
**Post date:** [October 25, 2021, 4:02pm UTC](https://discuss.elastic.co/t/possible-to-script-values-in-synthetics/287602/3 "2021-10-25T16:02:30Z")

</div>

@Dominique_Clarke great thanks for the information, while I saw stuff like: [synthetics-demo/demo.journey.js at main · elastic/synthetics-demo · GitHub](https://github.com/elastic/synthetics-demo/blob/main/e-commerce/demo.journey.js#L15), I didn't see anything mention it in the docs, so wasn't sure if it was an intended feature.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 22, 2021, 6:03pm UTC](https://discuss.elastic.co/t/possible-to-script-values-in-synthetics/287602/4 "2021-11-22T18:03:02Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
