ZEPIC SDK Setup: Excluding Bots and Crawlers
Overview
This guide explains how to load the ZEPIC Web SDK only for regular website visitors while preventing it from loading for visitors identified as bots or crawlers.
The solution uses the third-party isbot library to inspect the browser user-agent string. If the visitor is not identified as a bot, the ZEPIC SDK is added dynamically to the page.
What this implementation does
1. Loads the isbot bot-detection library.
2. Checks the visitor’s navigator.userAgent.
3. Detects whether the visitor is likely a bot or crawler.
4. Loads the ZEPIC Web SDK only when the visitor is not a bot.
Installation
Add the complete snippet below to your website’s shared layout, global header, or tag manager custom HTML area.
Place it in the <head> section or immediately before the closing </body> tag.
<!-- Step 1: Load the third-party bot-detection library -->
<script src="https://cdn.jsdelivr.net/npm/isbot@5"></script>
<!-- Step 2: Load ZEPIC only for non-bot visitors -->
<script>
if (!isBot(navigator.userAgent)) {
const zepicScript = document.createElement("script");
zepicScript.src =
"https://au.zepiccdn.com/40d92b84-1f2d-3c97-956e-73b566b3c95f/ec8ff64e-77a9-3f51-a08f-04ed5d5923d3/sdk.js";
zepicScript.async = true;
document.head.appendChild(zepicScript);
}
</script>How it works
The browser provides a user-agent value through:
navigator.userAgentThe isbot library checks that value:
isBot(navigator.userAgent)The result is:
- true — the visitor is likely a bot or crawler.
- false — the visitor is likely a regular visitor.
This condition ensures ZEPIC loads only for non-bot visitors:
if (!isBot(navigator.userAgent)) {
// Load the ZEPIC SDK
}The ! character means “not.” Therefore, the code enters the block only when isBot() returns false.
Important implementation requirements
- Load the isbot library before calling isBot().
- Add the ZEPIC SDK through the conditional code only.
- Remove any existing direct ZEPIC SDK tag from the website. Otherwise, it may still load for bots.
Do not use this elsewhere on the page:
<script
src="https://au.zepiccdn.com/40d92b84-1f2d-3c97-956e-73b566b3c95f/ec8ff64e-77a9-3f51-a08f-04ed5d5923d3/sdk.js"
async
></script>Where to add the code
Add the complete snippet once in a location loaded across all applicable pages, such as:
- Website-wide <head> template
- Global footer template
- Shared master layout
- Google Tag Manager Custom HTML tag
- CMS header/footer code-injection section
For single-page applications, add it to the main HTML entry file or application layout so it runs once when the site initializes.
Testing
To confirm that ZEPIC loads for a regular visitor:
- Open the website in a standard browser.
- Open Developer Tools.
- Go to the Network tab.
- Reload the page.
- Search for sdk.js.
- Confirm that a request to https://au.zepiccdn.com is present.
To verify bot handling, test using a bot user agent or an appropriate crawler-testing tool. When the visitor is detected as a bot, no request to the ZEPIC SDK URL should appear.
Content Security Policy configuration
If your website uses a Content Security Policy (CSP), ensure these domains are allowed in the script-src directive:
https://cdn.jsdelivr.net
https://au.zepiccdn.comExample:
Content-Security-Policy: script-src 'self' https://cdn.jsdelivr.net https://au.zepiccdn.com;Merge this with your existing CSP rather than replacing your site’s policy.
Third-party library information
This implementation uses isbot, an open-source third-party library loaded from jsDelivr:
<script src="https://cdn.jsdelivr.net/npm/isbot@5"></script>isbot analyzes browser user-agent strings to identify likely bots, crawlers, and automated clients.
The isbot library is not developed, owned, maintained, or supported by Zepic. Zepic only provides the Web SDK URL used in the conditional-loading portion of the code.
Disclaimer and limitations
The isbot library is a third-party dependency. Its availability, detection accuracy, updates, security, licensing, and ongoing maintenance are outside Zepic’s control.
Use this implementation at your own risk. Review the isbot documentation, license, versioning policy, and suitability for your own technical, legal, privacy, and compliance requirements before deployment.
User-agent-based bot detection is a best-effort approach only:
- Some bots may appear as normal browsers.
- Some regular visitors may use browser configurations that resemble automated traffic.
- User-agent strings can be changed or spoofed.
Do not use this logic as a security or access-control mechanism. It is intended only to reduce unnecessary ZEPIC SDK loading for known or likely bots.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article