Launch parameters on OK

When an app is launched on OK, the platform sends it additional parameters containing information about the user and the launch source. These values are sent as URL parameters to the address indicated in the game or app settings.

To send the parameters, type them in the URL after the ? character, e.g. https://my-app.com/start?param1=value1.

To obtain the launch parameters in the app code, use one of the following methods:

  • •
    Extract the value of the href property of the window.location object.
  • •
    Call the VKWebAppGetLaunchParams event.

Parameter signature

To protect yourself from value substitution due to a possible data leakage, use a parameter signature. For details, see Launch parameters signature.

Parameters

Parameter
Type
Description
sign
string
base64 string is the launch parameters signature. It is used to detect parameter substitution by third parties. For details, see Launch parameters signature.
vk_access_token_settings
string
List of access rights of the user that launched the app. Each value in the list corresponds to the user's data range that can be accessed. Values in the list are divided by commas, e.g. phone_number,email,geo_data. For the full list of permissions, see OK documentation, section App permissions.
vk_app_id
integer
Linked VK app identifier.
vk_are_pushes_enabled
integer
Whether the user has notifications from the VK app enabled.
vk_ok_app_id
integer
App identifier on OK.
vk_are_notifications_enabled
integer
Whether the app is allowed to send notifications:    • 0 — not allowed.    • 1 — allowed.
vk_client
string
App launch platform identifier. Always ok for OK.
vk_is_app_user
integer
Information on whether the user has installed the app:    • 0 — app is not installed.    • 1 — app is installed. The app is considered installed after the user launches it for the first time.
vk_language
string
User interface language of the app.
vk_platform
string
Platform the app was launched on:    • desktop_web_ok — OK desktop website (ok.ru).    • mobile_android_ok — OK mobile app for Android.    • mobile_iphone_ok — OK mobile app for iOS.    • mobile_web_ok — OK mobile website (m.ok.ru).
vk_ref
string
Source of the VK app launch. Games and mini apps have their own list of possible values:    • List of values for games    • List of values for mini apps
vk_ok_ref
string
Source of the app launch on OK. You can find the full list of values in the OK documentation, section List of possible points of switching to game.
vk_ts
integer
Launch parameters signature generation time. The signature is given in the sign parameter.
vk_user_id
integer
VK ID of the user that launched the app. If the app was opened by an OK user who doesn't have a linked VK ID, the field contains a technical identifier. When the user links their accounts, the technical identifier will be saved in the vk_original_vk_id field, and vk_user_id will contain their actual VK ID.
vk_ok_user_id
integer
Identifier of the OK user that launched the app.
vk_original_vk_id
integer
The original VK ID of the user. It may differ from vk_user_id if a technical identifier was assigned initially.

The vk_user_id, vk_ok_user_id and vk_original_vk_id parameters are used to sign in the user to the app. To check the authenticity of the received data, find out the signature and compare it to the received value of the sign parameter.

Sending arbitrary parameters

You can send arbitrary parameters to the app if necessary.

Launch via direct link

When launching the app via direct link, type the parameters after the # character in the address bar, for example:

https://vk.com/app1234567#param1=12345

Characters after # will be sent to the app in the hash URL parameter. This parameter always goes last among other sent parameters. All characters after it are characters typed after # in the app's URL.

You can also obtain parameters with the help of the hash parameter of the window.location object. To track the changes of this value in the app, use the VKWebAppLocationChanged and VKWebAppChangeFragment events of the VK Bridge library.

Using the question mark (?) to send parameters doesn't work when launching via direct link.

Launch parameters in the app settings

To indicate the launch parameters in the app settings, add a question mark and the parameters into the URL, for example:

https://my-game.example.com/start-page?param1=12345

You can obtain these parameters the same way you would obtain regular parameters of webpages, e.g. using the window.location.search property or the VKWebAppGetLaunchParams event.

You can't use the # character in URLs indicated in the app settings.

See also