Deep linking

Native apps in Ecwid Control Panel support deep linking, which means they can receive information before being loaded and opened. It provides your app with a new level of user interaction by reacting to the context sent to your app.

Pass a URL-encoded value – app_state to your application before loading and opening it for a user to achieve it.

Sending app state

A typical native application URL looks like this: https://my.ecwid.com/store/1234567#app:name=my-cool-app&parent-menu=sales

In case your app is called using deep linking, that URL will also have a new parameter - app_state: https://my.ecwid.com/store/1234567/#app:name=my-cool-app&app_state=orderId%3A%2012

The app_state parameter value is a URL encoded string with a specific application state your app can understand and process.

Receiving app state

Receiving and processing the externally called app state depends on the type of user authentication you are using. See the details below.

{
  "store_id": 1003,
  "lang": "en",
  "access_token":"xxxxxxxxxxxxxxxx",
  "app_state":"orderId%3A%2012"
}

Authentication example

GET https://www.example.com/my-app-iframe-page?payload=353035362c226163636573735f746f6b656e223a22776d6&app_state=orderId%3A%2012&cache-killer=13532

When authenticating a user, the app state will be delivered as a GET parameter app_state of your iframeUrl alongside the default parameters. Retrieve it server-side like any other value of a GET parameter, then save and use it in your app code.

<?php

// URL Encoded App state passed to the app
  if (isset($_GET['app_state'])){
    $app_state = $_GET['app_state'];
  }
?>

Learn more about Authentication in native apps