APP Tracking Short Link API Documentation

Preliminary Information


API Domain
https://allsha.re


APP ID
Each created application will have an APP ID, which is a string used for tracking. Example: OYcoAMYwEw1


Device ID
Each API requires a special parameter device_id, which is a string. The device_id is a device ID, usually generated using UUID to create a long random string cached in the app. It must remain unchanged after app installation. It can change upon reinstallation, but must stay the same while the app is not uninstalled.

API Details

App Installation Tracking
URL: POST https://allsha.re/track/app/install/${APPID}

json
Copy code
{"device_id": "XXXX-XXXX-XXXX-XXXX"}


Usage Scenario: Called only when the app is opened for the first time.

User Registration Tracking
URL: POST https://allsha.re/track/app/signup/${APPID}

json
Copy code
{"device_id": "XXXX-XXXX-XXXX-XXXX"}


Usage Scenario: Called only when the user successfully registers.

User Binding Tracking
URL: POST https://allsha.re/track/app/identify/${APPID}

json
Copy code
{"device_id": "XXXX-XXXX-XXXX-XXXX","account_id": "10001"}


Explanation: account_id is a string type, representing the unique identifier of the user in the app. If it is originally an integer, it can be converted to a string before being passed, e.g., if the ID is 10001, pass "account_id": "10001".
Usage Scenario: Called only when the user successfully logs in.

Sales Conversion Tracking
URL: POST https://allsha.re/track/app/conversion/${APPID}

json
Copy code
{"device_id": "XXXX-XXXX-XXXX-XXXX","account_id": "10001","conversion": 99.99}


Explanation: conversion is of double type, representing the amount of a single sale.
Usage Scenario: Called only when the user successfully makes a purchase.

Specific Page Redirect (Deep Linking)
Usage Scenario: When sharing a link with a user, the user clicks the link, and the app or webpage opens to a specified page.
Configuration Steps:

  1. Example Link:
perl
Copy code
https://allsha.re/app/{deeplink_short_code}?params=%7B%22path%22%3A%22%2Fchatting%22%2C%22id%22%3A%22yEW8kMHgqBL%22%7D
  • deeplink_short_code is the short link code you created.
  • params is the query parameter to be passed, generated as follows.

Generating Parameters:

javascript
Copy code
const params = {
    path: 'artical',
    id: '10001'
};
const encodedParams = encodeURIComponent(JSON.stringify(params));
const url = `https://allsha.re/app/${deeplinkShortCode}?params=${encodedParams}`;
  • params is an object containing the information needed to navigate to a specified page in the app.
  • The params need to be stringified and URL-encoded.

Tracking and Triggering Redirects
Steps:

Installation Event Tracking:

json
Copy code
{"device_id": "XXXX-XXXX-XXXX-XXXX"}
  • Explanation: Called when the app is opened for the first time. If the API response contains a params object, it needs to be parsed and handled according to the predefined rules.
  1. Open Event Tracking:
json
Copy code
{"device_id": "XXXX-XXXX-XXXX-XXXX","from_app": 1}
  • Explanation:
  • For mobile apps: Called when the app is opened after the first time. Pass from_app = 1 to indicate it's opened from the app.
  • For web: Called once when the page is initialized each time. No need to pass from_app, the default is web open.
    Note:
  • The tracking logic for mobile apps and web is similar, with differences in the timing and some parameters.
  • For web, UUID can be used to generate device_id, stored in a cookie for easy retrieval. No need to pass from_app = 1 for web, default is web open.

The above is the API usage guide. Specific implementation can be flexibly configured according to your business needs.If you have any questions, please contact support@socialbook.io