All communication with Clerks AI happens through our super fast REST API.
Regardless of the webshop platform, Clerk can always be integrated via API or with our Clerk.js solution that makes API calls from the frontend.
We then build extensions and integrations that bundle features from the API and Clerk.js to make integration smooth.
API #
The API is the cornerstone of Clerk’s functionality.
https://api.clerk.io/v2
Clerk.js #
Clerk.js makes it fast and enjoyable to integrate Clerk.io’s services into any store frontend.
Clerk.js does all the heavy lifting, such as making network requests, gracefully handling errors, rendering into the DOM and applying click and behavioral tracking out of the box.
<!-- Start of Clerk.io E-commerce Personalisation tool - www.clerk.io -->
<script type="text/javascript">
(function(w,d){
var e=d.createElement('script');e.type='text/javascript';e.async=true;
e.src='https://cdn.clerk.io/clerk.js';
var s=d.getElementsByTagName('script')[0];s.parentNode.insertBefore(e,s);
w.__clerk_q=w.__clerk_q||[];w.Clerk=w.Clerk||function(){ w.__clerk_q.push(arguments) };
})(window,document);
Clerk('config', {
key: 'insert_api_key'
});
</script>
<!-- End of Clerk.io E-commerce Personalisation tool - www.clerk.io -->
Extensions #
These installed into the platform as packages that bundle the feed, API calls, and Clerk.js.
They can take care of synchronization**, tracking, and inserting snippets.
Examples include Magento2, WooCommerce, and Prestashop.
As the extension will be on your server physically, you can extend or change it in the code as you see fit. Just make sure to keep your changes separate from the core files to avoid overwriting them when you update to a new release.
Most extensions sync data by creating endpoints on the webshop, which are then accessed with the Public and Private Key, just like when making CRUD calls. When you run a data sync, Clerks importer accesses each endpoint to receive the data in JSON format, through pagination.
https://awesomestore.com/clerk/product?key=insert_public&private_key=insert_private&page=1&limit=100
https://awesomestore.com/clerk/category?key=insert_public&private_key=insert_private&page=1&limit=100
https://awesomestore.com/clerk/order?key=insert_public&private_key=insert_private&page=1&limit=100
Integrations #
These use the webshop platform’s API to sync data, while snippets must be inserted manually into the theme files.
Examples here include Shopify, BigCommerce, and Lightspeed.
Integrations are hosted on Clerk’s servers, so while you can’t modify their code, they contain various configuration options from the Data page.
If we have an extension or integration for your platform, we recommend using it to simplify at least parts of the installation.
You can still choose to use it only for syncing data and then use the API or custom snippets for the frontend. In other words, think of them as toolkits that you can use to any degree you see fit.
Choosing Your Setup #
Doing a Clerk.js integration is often the fastest and leaves the non-tech employees of your company with way more control of the setup after the integration.
You also don’t have to worry about tracking and adding server load, as Clerk.js works in the frontend while the page is loading.
API setups are recommended if you have a lot of custom business logic you need to apply.
For example, if you are developing a B2B store, with unique prices and catalogues for each logged in customer, it’s likely easier to make API calls serverside, and apply the business logic after Clerk returns results.
Also, if you need to do a quick switch from another API to Clerk, it is often much faster to simply replace and reconfigure API calls than doing a Clerk.js installation, at least initially. Finally, if you are building an app, using the API is the best way of connecting it with Clerk.