Client library usage justification
There are numerous benefits to utilizing the JavaScript client library in opposition to making network requests directly to the Constructor API.
For nearly all applications, we strongly encourage the use of a client library when integrating with Constructor.
Preserving an upgrade path
- Constructor is constantly working to add new products as well as improve upon our core offerings. As products are released, all client libraries are updated to provide an easy to use interface to the corresponding product API.
- On occasion, changes may be made to existing API interfaces to enhance a feature or correct an issue. Through client library versioning we can adapt to changes like this without involving a code change for our customers - all that needs to be done is an upgrade of the client library to the most recent version.
Documentation and test coverage
- All Constructor client libraries come with full living documentation that is updated with each release - easing the burden of having to understand the potential intricacies of the API interface.
- The team takes test coverage seriously - especially when it comes to our open source repositories. The JavaScript client library, for example, has over 95% statement coverage across over 400 tests to ensure a consistent reliable experience for consumers.
Bot detection
- Client-side implementations through usage of a Constructor client library have built in bot detection by requiring that a "human-like" action is observed before transmitting tracking events.
- A list of known bot user-agent strings is cross referenced before behavioral events are dispatched.
Personalization and client version parameters
- Key parameters must be sent with requests to power personalization of results. Constructor client libraries automatically append these parameters to each request without any additional work for the consumer.
- A library identifier and version is appended automatically to ensure proper categorization of requests. This aids our internal alerting and monitoring systems be aware of the origin of requests and proactively alert us of any configuration issues.
Simplified approach to tracking
- When the client library is used to retrieve product data directly from the browser, key information essential for tracking is emitted automatically by the library. This vastly simplifies the tracking implementation, ensures accuracy and removes a reliance on interfacing with the DOM.
Due to the reasons preceding, we've received feedback from numerous customers that it's far easier to make use of the client library than make REST API calls directly. We've done our best to ensure our client libraries are as lightweight as possible and easy to integrate with most tech stacks, though we're open to feedback and often able to react quickly to specific needs should they arise.
Updated 2 months ago