# Personalise a story or start it at a specific point through its link

Source: https://knowledge.intractive.app/en/articles/personalise-a-story-through-its-link

You can fill story variables from the link a visitor opens, so the story knows something about them before they tap anything. Use it to greet people by name or send them straight to the part of the story meant for them.

## Add the variables to your story

A value from a link only lands in a variable that already exists in the story.

1. Open the story and select the **Variables** tab in the top bar. It's shown as an icon; hover over it to see its name.\
   \[screenshot: the Variables tab in the story top bar, with its name showing on hover\]
2. Add each variable you want to fill from a link.
3. Give it a type: number, text or yes/no.
4. Name it with lowercase letters, numbers and underscores only, such as `site_name` or `level_2`. Spaces, dashes and capitals aren't allowed.
5. Use the variable in your story. Show its value in the text of a Text/Image block with `{{@site_name}}`, with the `@` and no spaces inside the braces. Or use it as a condition in a **Logic Branch** content block.

Variables filled from a link work like any other variable. They also show up as a column in the **Submissions** tab, and per session under **Sessions** in story analytics, which only admins see.

## Give a share link fixed values

Use this when everyone who arrives through one link should get the same values. One project for many locations is a typical case: each location gets its own QR code that sets `site_name`, and visitors see the right content without choosing their location.

1. Create a share link for the story, or open one you made earlier. See Create an online share link.
2. Open the link's advanced settings with the cog icon.
3. Under **Set variables**, select **Add variable**. Pick the variable from the **Variable** dropdown, which lists the story's own variables, and type the value in **Value**, such as `site_name` with the value `harbour_north`. Select **Add variable** again for each extra variable.\
   \[screenshot: a share link's advanced settings with Set variables filled in for one variable\]
4. Select **Create** to save a new link. Changes to a link you made earlier save automatically.
5. Repeat for every channel or location that needs its own value, with one share link each.

Every share link has the same advanced settings, whether it's an online link, a QR code or a website embed.

## Add values to the link itself

Use this when the value differs per visitor.

Add each value to the story link as `@variable_name=value`. The first one follows a `?`, and every next one follows a `&`:

```javascript
https://web.intractive.app/<your-story>?@first_name=Sam&@partner=Acme&@level=3
```

When the session starts, Intractive reads every parameter that starts with `@` as a story variable. In this example, `first_name` becomes `Sam`, `partner` becomes `Acme` and `level` becomes `3`.

- Write spaces and special characters in URL encoding: `Acme%20Corp` for Acme Corp.
- Values arrive as text. For a number variable Intractive converts `10` into a number, and for a yes/no variable it converts `true` and `false`.
- A parameter without the `@`, or one that doesn't match a variable in the story, is ignored. The link still works and no error is shown.
- The parameters `lang`, `ref`, `r`, `h`, `s` and `sid` are reserved and keep their own meaning. Intractive doesn't treat them as variables.

## Which one to use

| Use **Set variables** on a share link when | Use parameters in the link when |
| --- | --- |
| The values are the same for everyone in one channel, and you know them when you create the link. | The values are different per visitor, from your CRM, your app, an email merge field or an ad platform. |
| You're using a QR code, which you can't change after printing. | You're sending people from your own website, app or email. |
| Visitors shouldn't be able to change the value. | It's fine that visitors can see and edit the value in the address bar. |

You can combine both. A share link can fix some values while the link adds others per visitor. If both set the same variable, the value on the share link wins.

## Start the story at a specific point

There's no separate setting to open a story at a chosen content block. You get the same result with a variable and a **Logic Branch** at the very start of the story. This lets you skip the intro for returning visitors, or send people who scan the QR code on a product straight to that product.

1. Add a variable the story can check, such as `entry_point`.
2. Give each link its own value for that variable, such as `product_page` for the QR code on your product and `newsletter_bottom` for the link in your email footer. Use **Set variables** on the share link or a parameter in the link.
3. On the first step of the main branch, add a **Logic Branch** content block.\
   \[screenshot: a Logic Branch at the start of the Main branch with one condition per entry\_point value\]
4. Add a condition for each value of `entry_point`. Set the condition's **Action** to **Start branch**, and pick a branch whose end jumps to the content block further in the story where those visitors should start. On the canvas, set the end of that branch to **Jump to a block…**. In the classic editor, use **Jump to another block**.
5. Leave the **Fallback** on **Do Nothing**. Visitors who arrive through a link without a value then play the story from the start as usual.

The **Logic Branch** decides straight away, so visitors never see the content blocks they skip.

Make sure the place where visitors start makes sense without the steps they skipped. Variables that are set or scored in skipped content blocks have no value yet, so branches that react to earlier answers won't work as planned.

## Things to keep in mind

- Visitors can see the link. Never put passwords, tokens or other secrets in a parameter. Identifiers and display values are fine.
- Values from a link are set when a new session starts. A returning visitor whose session is still running keeps the values they had. Turn on **Always restart** on the share link if every visit should set the values again. Adding `r=1` to the link, for example `?r=1`, also starts the story fresh on that visit.
- Test your link in a private browser window before you send it out, and check that the story shows the right content and takes the right branches.\
  \[screenshot: the story open on a phone, greeting the visitor with a name from the link\]

Each share link shows up as its own row in **Top traffic sources** in story analytics, so you can check which links visitors actually use.

## Next

- Create an online share link
- Creating branches
