Retrieve analytics data for multiple social media accounts. Provides metrics for the last 7 days with comparison to the previous 7 days. Supports filtering by platforms and specific connected accounts.
POST https://services.leadconnectorhq.com/social-media-posting/statistics
Autorización
Bearer token generado desde el portal Leadway. Ver Autenticación .
Version
string
default: "2021-07-28"
required
Versión de la API.
Query parameters
locationId
string
default: "w37swmmLbA02zgqKPpxITe2"
required
Account ID
Body
Array of connected social media account IDs to fetch analytics for. This can be found as ‘profileId’ in /accounts api.
Array of social media platforms to filter analytics by. If not provided, all platforms will be included. NOTE: Linkedin (PAGE only) and Tiktok (BUSINESS only) are supported.
Respuestas
201 - Successfully retrieved analytics data
Analytics data grouped by metrics and platforms Array of day names for the analytics period
Aggregated metrics totals Post performance metrics over time Detailed breakdowns by metric and platform Platform-wise totals with time series data Demographic data breakdown message
string
default: "Analytics Built Successfully"
traceId
string
default: "42fc8dd8-d55b-475f-944f-9efb90d77564"
{
"results" : {
"dayRange" : [
"Mon" ,
"Tue" ,
"Wed" ,
"Thu" ,
"Fri" ,
"Sat" ,
"Sun"
],
"totals" : {
"posts" : 0 ,
"likes" : 0 ,
"followers" : 0 ,
"impressions" : 0 ,
"comments" : 0
},
"postPerformance" : {
"posts" : {
"google" : [
0 ,
0 ,
0 ,
0 ,
0 ,
0 ,
0
]
},
"impressions" : [
0 ,
0 ,
0 ,
0 ,
0 ,
0 ,
0
],
// truncado: 136 lineas mas
}
400 - Bad Request - Occurs when more than 100 accounts are requested or invalid parameters are provided
401 - Unauthorized - Invalid or missing authentication credentials
422 - Unprocessable Entity - Invalid request body format
Ejemplo
curl -X POST 'https://services.leadconnectorhq.com/social-media-posting/statistics' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"profileIds": [
"67a5a9aa776c837de4aa5b12"
],
"platforms": [
"facebook",
"instagram"
]
}'
const response = await fetch ( 'https://services.leadconnectorhq.com/social-media-posting/statistics' , {
method: 'POST' ,
headers: {
Authorization: `Bearer ${ process . env . LEADWAY_TOKEN } ` ,
Version: '2021-07-28' ,
'Content-Type' : 'application/json' ,
},
body: JSON . stringify ({ "profileIds" : [ "67a5a9aa776c837de4aa5b12" ], "platforms" : [ "facebook" , "instagram" ]}),
});
const data = await response . json ();
import os, requests
response = requests.request(
'POST' ,
'https://services.leadconnectorhq.com/social-media-posting/statistics' ,
headers = {
'Authorization' : f "Bearer { os.environ[ 'LEADWAY_TOKEN' ] } " ,
'Version' : '2021-07-28' ,
'Content-Type' : 'application/json' ,
},
json = { "profileIds" : [ "67a5a9aa776c837de4aa5b12" ], "platforms" : [ "facebook" , "instagram" ]},
)
data = response.json()
<? php
$ch = curl_init ( 'https://services.leadconnectorhq.com/social-media-posting/statistics' );
curl_setopt_array ( $ch , [
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv ( 'LEADWAY_TOKEN' ),
'Version: 2021-07-28' ,
'Content-Type: application/json' ,
],
CURLOPT_POSTFIELDS => json_encode ({ 'profileIds' : [ '67a5a9aa776c837de4aa5b12' ], 'platforms' : [ 'facebook' , 'instagram' ]}),
]);
$data = json_decode ( curl_exec ( $ch ), true );