📱 Get Install Analytics via REST API
Use ChottuLink's REST API to retrieve install analytics data for your dynamic links. This endpoint provides detailed install statistics including total installs, 7-day installs, and 30-day installs for any specific link in your account. This feature requires a paid subscription plan.
Endpoint​
POST https://api2.chottulink.com/chotuCore/pa/v1/install-analytics
The production endpoint may differ from the staging URL shown above. Please verify the correct endpoint URL for your environment.
Authentication​
Include your API key in the request header:
API-KEY: c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Replace c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx with your actual REST API integration key from
the ChottuLink Dashboard.
Request Parameters​
- You must provide either
shortUrlorlinkId - Both parameters cannot be empty
- Use
shortUrlfor easier identification - Use
linkIdfor programmatic access - This feature requires a paid subscription plan
Install Analytics Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| shortUrl | string | No* | The short URL of the link to get install analytics for | https://url.com/dummy |
| linkId | string | No* | The unique ID of the link to get install analytics for | d15ca68a-397e-4f8b-8e38-4e9cba7bfth56 |
*Either shortUrl or linkId must be provided
Example Request​
Using Short URL​
curl --location 'https://api2.chottulink.com/chotuCore/pa/v1/install-analytics' \
--header 'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"shortUrl": "https://url.com/dummy"
}'
Using Link ID​
curl --location 'https://api2.chottulink.com/chotuCore/pa/v1/install-analytics' \
--header 'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"linkId": "d15ca68a-397e-4f8b-8e38-4e9cba7bfth56"
}'
Response​
Success Response​
Status Code: 200 OK
{
"installs_last_30_days": 0,
"installs_last_7_days": 0,
"total_installs": 0
}
Response Fields​
Install Analytics Object Fields
| Field | Type | Description | Example |
|---|---|---|---|
| installs_last_30_days | integer | Number of installs recorded in the last 30 days from the current date | 0 |
| installs_last_7_days | integer | Number of installs recorded in the last 7 days from the current date | 0 |
| total_installs | integer | Total number of installs recorded for the link since it was created | 0 |
Error Responses​
Missing Parameters​
Status Code: 400 Bad Request
{
"code": 101,
"errorMessage": "There was one or more validation error(s)",
"errors": [
{
"errorMessage": "REQUIRED_FIELD_MISSING",
"fieldName": "Both 'shortUrl' and 'linkId' cannot be empty. At least one must be provided."
}
]
}
This error occurs when one or more required inputs are missing from the request.
Unauthorized Access​
Status Code: 401 Unauthorized
{
"code": 130,
"errorMessage": "Authorization Failed!",
"error": {
"errorMessage": "'API-KEY' missing",
"fieldName": "UNAUTHORIZED_ACCESS"
}
}
This error occurs when the user does not send the API-KEY in the request headers.
Access Denied - Subscription Required​
Status Code: 403 Forbidden
{
"code": 115,
"errorMessage": "Access Denied",
"error": {
"errorMessage": "UNAUTHORIZED_ACCESS",
"fieldName": "Not a valid subscription to access install analytics. Please upgrade your subscription to unlock this feature."
}
}
This error occurs when the user has not subscribed to a paid plan or does not have an active subscription. Install analytics is a premium feature that requires an active paid subscription.
Usage Examples​
- JavaScript
- Python
- PHP
- Node.js
- cURL
const axios = require('axios');
async function getInstallAnalytics(shortUrl) {
try {
const response = await axios.post(
'https://api2.chottulink.com/chotuCore/pa/v1/install-analytics',
{
shortUrl: shortUrl
},
{
headers: {
'API-KEY': 'c_api_xxxxxxxxxxxxxxxxxxxx',
'Content-Type': 'application/json'
}
}
);
return response.data;
} catch (error) {
if (error.response?.status === 403) {
console.error('Install analytics requires a paid subscription');
}
console.error('Error fetching install analytics:', error.response?.data || error.message);
throw error;
}
}
// Usage
getInstallAnalytics('https://url.com/dummy').then(data => {
console.log('Total installs:', data.total_installs);
console.log('Last 7 days:', data.installs_last_7_days);
console.log('Last 30 days:', data.installs_last_30_days);
});
import requests
def get_install_analytics(short_url=None, link_id=None):
url = "https://api2.chottulink.com/chotuCore/pa/v1/install-analytics"
headers = {
'API-KEY': 'c_api_xxxxxxxxxxxxxxxxxxxx',
'Content-Type': 'application/json'
}
# Prepare payload
payload = {}
if short_url:
payload['shortUrl'] = short_url
elif link_id:
payload['linkId'] = link_id
else:
raise ValueError("Either short_url or link_id must be provided")
try:
response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()
return response.json()
except requests.exceptions.HTTPError as e:
if response.status_code == 403:
print("Install analytics requires a paid subscription")
print(f"Error fetching install analytics: {e}")
raise
except requests.exceptions.RequestException as e:
print(f"Error: {e}")
raise
# Usage
data = get_install_analytics(short_url="https://url.com/dummy")
print("Total installs:", data['total_installs'])
print("Last 7 days:", data['installs_last_7_days'])
print("Last 30 days:", data['installs_last_30_days'])
<?php
function getInstallAnalytics($shortUrl = null, $linkId = null) {
$url = "https://api2.chottulink.com/chotuCore/pa/v1/install-analytics";
$headers = [
'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxx',
'Content-Type: application/json'
];
// Prepare payload
$payload = [];
if ($shortUrl) {
$payload['shortUrl'] = $shortUrl;
} elseif ($linkId) {
$payload['linkId'] = $linkId;
} else {
throw new Exception("Either shortUrl or linkId must be provided");
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode === 200) {
return json_decode($response, true);
} elseif ($httpCode === 403) {
throw new Exception("Install analytics requires a paid subscription");
} else {
throw new Exception("Error fetching install analytics: HTTP {$httpCode}");
}
}
// Usage
try {
$data = getInstallAnalytics("https://url.com/dummy");
echo "Total installs: " . $data['total_installs'] . "\n";
echo "Last 7 days: " . $data['installs_last_7_days'] . "\n";
echo "Last 30 days: " . $data['installs_last_30_days'] . "\n";
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
?>
const axios = require('axios');
async function getInstallAnalytics(shortUrl) {
try {
const response = await axios.post(
'https://api2.chottulink.com/chotuCore/pa/v1/install-analytics',
{
shortUrl: shortUrl
},
{
headers: {
'API-KEY': 'c_api_xxxxxxxxxxxxxxxxxxxx',
'Content-Type': 'application/json'
}
}
);
return response.data;
} catch (error) {
if (error.response?.status === 403) {
console.error('Install analytics requires a paid subscription');
}
console.error('Error fetching install analytics:', error.response?.data || error.message);
throw error;
}
}
// Usage
getInstallAnalytics('https://url.com/dummy').then(data => {
console.log('Install Analytics:', data);
});
# Using shortUrl
curl --location 'https://api2.chottulink.com/chotuCore/pa/v1/install-analytics' \
--header 'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"shortUrl": "https://url.com/dummy"
}'
# Using linkId
curl --location 'https://api2.chottulink.com/chotuCore/pa/v1/install-analytics' \
--header 'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"linkId": "d15ca68a-397e-4f8b-8e38-4e9cba7bfth56"
}'
Best Practices​
- Parameter Validation: Always validate that either
shortUrlorlinkIdis provided - Error Handling: Implement proper error handling for all response codes, especially 403 for subscription checks
- Subscription Check: Verify your subscription status before attempting to use this endpoint
- Caching: Cache install analytics data when appropriate to reduce API calls
- Rate Limiting: Respect API rate limits and implement exponential backoff
- Data Validation: Validate response data before processing
Install Analytics Best Practices​
- Choose the Right Parameter: Use
shortUrlfor human-readable identification,linkIdfor programmatic access - Handle Zero Installs: Always handle cases where installs are 0
- Monitor Trends: Track install analytics over time to identify patterns
- Cache Results: Cache install analytics data for frequently accessed links
- Error Recovery: Implement retry logic for network failures, but respect 403 errors (subscription required)
Error Handling Best Practices​
- Check HTTP Status Codes: Always verify response status
- Handle Subscription Errors: Specifically handle 403 errors to inform users about subscription requirements
- Handle Network Errors: Implement retry logic for network failures
- Validate Response Format: Ensure response structure is as expected
- Log Errors: Log API errors for debugging purposes
- User-Friendly Messages: Provide meaningful error messages to users, especially for subscription-related errors
Rate Limits​
The API is subject to rate limiting. Please contact support for specific rate limit information.
Subscription Requirements​
Install analytics is a premium feature that requires an active paid subscription. If you receive a 403 Forbidden error, please upgrade your subscription plan to access this feature.