Suivre un Lead
curl --request POST \
--url https://api.example.com/api/events/leadimport requests
url = "https://api.example.com/api/events/lead"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/events/lead', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/events/lead",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/events/lead"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/events/lead")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/events/lead")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyAPI Events
Suivre un Lead
Créer un événement de conversion lead
POST
/
api
/
events
/
lead
Suivre un Lead
curl --request POST \
--url https://api.example.com/api/events/leadimport requests
url = "https://api.example.com/api/events/lead"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/events/lead', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/events/lead",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/events/lead"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/events/lead")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/events/lead")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyEndpoint
POST https://track.taap.it/api/events/lead
Authentification
- Côté serveur (Recommandé)
- Côté client
Utilisez votre clé API secrète :
Authorization: Bearer taapit_sk_xxxxxxxxxxxx
Utilisez votre clé publique :
X-Publishable-Key: taapit_pk_xxxxxxxxxxxx
Corps de la requête
| Champ | Type | Requis | Description |
|---|---|---|---|
trackingId | string | ✓ | Le ta_tid du cookie ou paramètre URL |
customer | object | ✓ | Informations client |
customer.externalId | string | ✓ | Votre ID utilisateur/client interne |
customer.email | string | Adresse email du client | |
customer.firstname | string | Prénom du client | |
customer.lastname | string | Nom du client | |
customer.phoneNumber | string | Numéro de téléphone du client | |
customer.avatarUrl | string | URL de l’avatar du client | |
metadata | object | Données personnalisées (paires clé-valeur) |
Exemples
- cURL
- SDK Node.js
- Hook React
- JavaScript
curl -X POST https://track.taap.it/api/events/lead \
-H "Authorization: Bearer taapit_sk_xxx" \
-H "Content-Type: application/json" \
-d '{
"trackingId": "rLnWe1uz9t282v7g",
"customer": {
"externalId": "user_123",
"email": "john@example.com",
"firstname": "John",
"lastname": "Doe"
},
"metadata": {
"source": "signup-form"
}
}'
import { Taapit } from 'taapit-sdk';
const taapit = new Taapit({
apiKey: process.env.TAAPIT_API_KEY,
});
await taapit.track.lead({
trackingId: 'rLnWe1uz9t282v7g',
customer: {
externalId: 'user_123',
email: 'john@example.com',
firstname: 'John',
lastname: 'Doe',
},
metadata: {
source: 'signup-form',
},
});
import { useTaapitAnalytics } from 'taapit-sdk/react';
function SignUpForm() {
const { trackLead } = useTaapitAnalytics();
const handleSignUp = async (user) => {
trackLead({
customer: {
externalId: user.id,
email: user.email,
firstname: user.firstName,
lastname: user.lastName,
},
metadata: {
source: 'signup-form',
},
});
};
}
<script src="https://taap.it/api/sdk" data-publishable-key="taapit_pk_xxx"></script>
<script>
taapit.trackLead({
customer: {
externalId: 'user_123',
email: 'john@example.com',
firstname: 'John',
lastname: 'Doe',
},
metadata: {
source: 'signup-form',
},
});
</script>
Réponse
- 200 OK
- 400 Bad Request
- 401 Unauthorized
- 404 Not Found
{
"ok": true
}
{
"error": "Missing customer.externalId"
}
{
"error": "Invalid API key"
}
{
"error": "Click not found for this trackingId"
}
Codes d’erreur
| Code HTTP | Erreur | Description |
|---|---|---|
| 400 | Invalid payload | Validation du corps de requête échouée |
| 400 | Missing customer.externalId | Champ requis non fourni |
| 401 | Invalid API key | Clé API invalide ou révoquée |
| 401 | Hostname not in allowed list | Origine non autorisée (côté client) |
| 403 | This click does not belong to your workspace | trackingId appartient à un autre workspace |
| 404 | Click not found for this trackingId | trackingId n’existe pas ou a expiré |
⌘I