@voicenter-team/lead-tracker
v0.9.35
Published
The Lead Tracker Library is a powerful tool for tracking and sharing lead data across multiple domains using a centralized API. It enables seamless capture and synchronization of query parameters and referrer URLs, making it easier to track and analyze
Downloads
2,358
Keywords
Readme
Lead Tracker Library
The Lead Tracker Library is a powerful tool for tracking and sharing lead data across multiple domains using a centralized API. It enables seamless capture and synchronization of query parameters and referrer URLs, making it easier to track and analyze user behavior across your digital ecosystem.
Features
- 🌐 Cross-Domain Data Sharing: Easily share lead data across multiple domains using a secure and efficient API-based communication mechanism.
- 📝 Query Parameter Tracking: Automatically capture and store query parameters from the current URL, allowing you to track important lead information.
- 🔄 Real-Time Synchronization: Keep lead data in sync across all domains in real-time, ensuring consistent and up-to-date information.
- 🔒 Secure Communication: Utilize secure API endpoints to exchange data between domains, maintaining data integrity and privacy.
- 🎛️ Customizable Configuration: Tailor the behavior of the Lead Tracker Library to your specific needs with customizable options such as API endpoints.
- 📊 Easy Integration: Seamlessly integrate the library into your existing web applications with minimal setup and configuration.
Installation
To install the Lead Tracker Library, simply include the library file in your project:
<script src="https://mirrored-lead-tracker-cdn.pages.dev/lead-tracker.umd.js"></script>
Or, if you're using a module bundler, you can install it via npm:
npm install @voicenter-team/lead-tracker
Then, import the library in your JavaScript code:
import LeadTracker from '@voicenter-team/lead-tracker'
Usage
- Create a new instance of the LeadTracker class, passing in the necessary configuration options:
const leadTracker = new LeadTracker({
leadTrackerModuleName: 'myLeadTracker',
apiOptions: {
setQueryApi: 'https://api.example.com/set-query',
getAllQueryApi: 'https://api.example.com/get-all-query',
},
silent: false,
});
- Initialize the lead tracker by calling the
init
method:
leadTracker.init()
The Lead Tracker Library will automatically capture query parameters from the current URL and send them to the specified API endpoint for storage.
To access the stored query parameters, you can use the getQueryParams method:
const queryParams = leadTracker.getQueryParams()
console.log(queryParams)
Configuration Options
The LeadTracker constructor accepts an object with the following configuration options:
leadTrackerModuleName
(required): The module name for the lead tracker. It will be used for logging and storage.apiOptions
(required): An object containing the API endpoints for setting and retrieving query parameters.setQueryApi
(required): The API endpoint for setting query parameters. This endpoint should accept a POST request with the query parameters in the request body.getAllQueryApi
(required): The API endpoint for retrieving all query parameters. This endpoint should return a JSON object with the query parameters.
silent
(optional): If set totrue
, the library will not log any messages. Default istrue
.
API Endpoints
The Lead Tracker Library communicates with the following API endpoints:
- Set Query API
POST
request to the specifiedsetQueryApi
endpoint with the following payload:
{
"fingerprint": "visitor-fingerprint",
"moduleName": "lead-tracker-module-name",
"data": {
"time": "timestamp",
"referrerUrl": "referrer-url",
"key1": "value1",
"key2": "value2"
}
}
- Get All Query API
POST
request to the specifiedgetAllQueryApi
endpoint with the following payload:
{
"fingerprint": "visitor-fingerprint",
"moduleName": "lead-tracker-module-name"
}
The API should respond with the following data:
{
"data": [
{
"time": "timestamp",
"referrerUrl": "referrer-url",
"key1": "value1",
"key2": "value2"
}
]
}
Contributing
Contributions to the Lead Tracker Library are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
License
The Lead Tracker Library is open-source software licensed under the MIT license.