1. Introduction to LeadDyno Tracking
LeadDyno’s tracking system allows you to monitor visitors, leads, and purchases generated by both your affiliates and regular site traffic.
This guide outlines the essential steps to implement tracking using our REST API, with a focus on tracking affiliate-driven data.
Using the REST API, you can track:
-
Visitors
Individuals who visit your site after being referred by an affiliate. -
Leads
Potential customers who engage with your site, such as signing up or creating an account. Once they complete a purchase, they are classified as customers. -
Purchases
Orders made by customers who were referred by an affiliate, either through a link or an affiliate coupon.
2. API Authentication
All requests to LeadDyno’s API require authentication using your unique API Private key. This key verifies access to your account and must be included in each request.
Always ensure that your API keys are stored securely. Avoid exposing them in client-side code or public repositories.
Steps:
1. Get Your API Key:
Find your API key in your LeadDyno Account - Profile section.
2. Include the API Key:
Add the key
as a parameter in the request header or URL query string.
Example:
curl -X GET "https://api.leaddyno.com/v1/visitors?key=YOUR_PRIVATE_KEY"
3. Visitor Tracking
Tracking visitors is the first step in capturing valuable data on who is interacting with your website through affiliate links. LeadDyno’s API provides an endpoint specifically for registering visitors.
Parameters Needed:
• key
: Your API Private key.
• url
: The URL the visitor landed on, including any query parameters (e.g., afmc for the affiliate code).
Example:
curl -X POST "https://api.leaddyno.com/v1/visitors" \
-d key="YOUR_PRIVATE_KEY" \
-d url="https://www.example.com?afmc=chr123"
In this example, if the url
parameter contains an afmc query (which represents an affiliate code), the visitor will be automatically linked to the affiliate associated with the code chr123
.
Example Response:
{
"id": 987654321,
"created_at": "2024-09-01T18:44:20Z",
"updated_at": "2024-09-01T18:44:21Z",
"tracking_code": "********-****-****-****-************",
"lead": null,
"url": {
"id": 123456789,
"url": "https://www.example.com?afmc=chr341"
},
"referrer": null,
"search_term": null,
"affiliate": {
"id": 1234567,
"email": "affiliate@example.com"
},
"campaign": null
}
For more details about creating visitors, refer to the Create a Visitor API documentation.
To explore all available visitor endpoints, visit the LeadDyno Visitor API documentation.
4. Lead Tracking
After tracking visitors, the next step is to capture leads—potential customers who interact with your website by signing up, filling out a form, or taking another action. LeadDyno’s API allows you to register leads and link them to the correct affiliate, if applicable.
Parameters Needed:
• key
: Your API Private key.
• email
: The email address of the lead.
• url
: The URL the lead interacted with.
• code
: The affiliate code (if the lead was referred by an affiliate).
Optional Parameters:
• first_name
: The lead’s first name.
• last_name
: The lead’s last name.
Example:
curl -X POST "https://api.leaddyno.com/v1/leads" \
-d key="YOUR_PRIVATE_KEY" \
-d email="lead@example.com" \
-d url="https://www.example.com/signup" \
-d code="AFFILIATE_CODE"
This request captures a lead’s information. If the lead was referred by an affiliate using an affiliate code, LeadDyno will automatically associate the lead with the appropriate affiliate.
For more details about creating leads, refer to the Create a Lead API documentation.
To explore all available lead endpoints, visit the LeadDyno Lead API documentation.
5. Purchase Tracking
Tracking purchases is essential for ensuring that affiliates are properly credited for the sales they refer. LeadDyno’s API enables you to track completed purchases and associate them with the correct affiliate.
Parameters Needed:
• key
: Your API Private key.
• email
: The email address of the lead.
• url
: The URL the lead interacted with.
• code
: The affiliate code (if the lead was referred by an affiliate).
Example:
curl -X POST "https://api.leaddyno.com/v1/purchases" \
-d key="YOUR_PRIVATE_KEY" \
-d email="lead@example.com" \
-d amount="99.99" \
-d url="https://www.example.com/checkout" \
-d code="AFFILIATE_CODE"
This request registers the purchase and attributes it to the affiliate associated with the provided code. However, your affiliate settings may impact who receives credit for the referral. For more details, refer to the Affiliate Settings article.
For more details about purchase tracking, refer to the Create a Purchase API documentation.
To explore all available purchase endpoints, visit the LeadDyno Purchase API documentation.
6. Handling Errors and Responses
LeadDyno uses standard HTTP response codes to indicate the success or failure of an API request. Codes in the 2xx range indicate success, while codes in the 4xx range indicate an error with the information provided (e.g., a required parameter was omitted). Codes in the 5xx range indicate a server error (these are rare).
Common HTTP Response Codes:
• 200 OK: The request was successful.
• 400 Bad Request: The request was unacceptable, often due to missing a required parameter.
• 401 Unauthorized: No valid API key provided.
• 404 Not Found: The requested resource doesn’t exist.
• 500 Server Error: Something went wrong on LeadDyno’s end (these are rare).
Error Handling Recommendations:
• Validate Input: Ensure all required parameters are included and correctly formatted.
• Graceful Handling: Handle 400 and 401 errors by checking for missing or invalid parameters, such as an incorrect API key.
• Retry on 5xx: For server-side errors, consider retrying the request with exponential backoff to avoid overwhelming the API.
See also
Explore the full LeadDyno REST API Documentation for all available endpoints.