# Variable %ref%

### First a little theory

{% hint style="info" %}
**A referral link** is a link that contains information from where the user follows it.&#x20;
{% endhint %}

For example, we place a link in an advertising campaign, and users get to our bot through it.&#x20;

The bot reads the link, extracting the %ref% parameter, which specifies the referral source.&#x20;

Description of the %ref% and %ref\_source% parameters can be seen in the "Variables" section:

![](https://1932399487-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuRfd5lEYYH6D50QjzeAX%2Fuploads%2F3b5O2YtU5Bc20O5clCos%2FRef.png?alt=media\&token=80613727-d4cf-4155-8b59-b3f3e9ca8bf5)

### How to use it?

Write a link like this...

* For VK groups:

> [https://vk.me/группа?ref= ](https://vk.me/group?ref=)

* For Telegram:&#x20;

> <https://t.me/channel?start=>

Instead of "group" or "channel" - the name of your community from the address bar. After the = sign, indicate in Latin letters the source where you place this link, for example, "advertisement".

So the finished link might look like this:&#x20;

* <https://vk.me/club192634149?ref=advertisement>
* <https://t.me/smartbotpro?start=advertisement>

After clicking on the link, the "reklama" parameter will be saved as a person's user variable, and in the future, the parameter can be used for conditions in the script.

![](https://1932399487-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuRfd5lEYYH6D50QjzeAX%2Fuploads%2FxZvSIJjATv0TlB2RIfTR%2F%D0%A3%D1%81%D0%BB%D0%BE%D0%B2%D0%B8%D0%B5%20%D0%BD%D0%B0%20ref.png?alt=media\&token=99132bcd-6cf8-470d-996e-4dce30a4615c)

Now you know how to create and apply referral links in Smartbot Pro!
