Integration Method Guide
1. API vs SDK Integration
GoWit provides two main integration methods for on-site ads: the JavaScript SDK and the REST API. Each has its own use cases, benefits, and trade-offs.
JavaScript SDK (Quick Start)
- Purpose: Ideal for quickly launching display ads with minimal development effort.
- How it works: Add a
<script>
snippet to your web pages and configure basic settings. - Functionality:
- Automatically renders ready-made display ad components.
- Handles impression and click measurement out-of-the-box.
- Supports contextual targeting using optional parameters (session ID, search term, category path, etc.).
- Pros:
- Very fast go-live (1–2 weeks).
- No need to manually implement ad rendering or event tracking.
- Good for banners and carousels on web and mobile web.
- Cons:
- Only supports Display Ads (banner, video). No Sponsored Product Ads.
- Less control over the ad UI.
- Best for: Pilot projects, MVPs, or quick banner ad campaigns.
REST API (Full Integration)
- Purpose: Designed for complete control over ad rendering, data handling, and event tracking.
- How it works: Your server communicates directly with GoWit's backend using REST API calls.
- Functionality:
- Supports all ad formats: Sponsored Products, Banners, Video, Native Ads, etc.
- Allows you to design your own UI and fully control ad presentation.
- Gives you full ownership of ad data, logs, and analytics.
- Pros:
- Future-proof — supports new ad formats without waiting for SDK updates.
- Total flexibility and branding control.
- Cons:
- Longer development time (several weeks).
- Requires manual implementation of event tracking.
- Best for: Advanced integrations with multiple ad formats and full custom UI.
2. Client-Side vs Server-Side Integration
Client-Side (Browser/SDK)
- Setup Effort: Very low — just include the JS SDK or minimal frontend calls.
- Ad Format Support: Limited to banners/display ads.
- UI Control: Less customization — uses GoWit-provided templates.
- Data & Analytics: Limited access; tracking handled in the browser.
- Reliability: Susceptible to ad blockers and browser/network interruptions.
- Privacy: User data is sent directly to GoWit; must handle consent in-browser.
Server-Side (Server-to-Server API)
- Setup Effort: Higher — requires backend development.
- Ad Format Support: Supports all ad formats.
- UI Control: Full customization and branding control.
- Data & Analytics: Full data ownership and logging.
- Reliability: More reliable event tracking (no browser dependencies).
- Privacy: Data stays within your backend; easier GDPR/CCPA compliance.
Recommendation: Use Server-Side for production environments to ensure robustness and cross-platform consistency.
3. Web vs Mobile App Integration
General Notes
- GoWit APIs and formats work identically on web and mobile apps.
- One integration can serve both web and mobile inventory.
Differences in Implementation
- Web: SDK is quick to integrate.
- Mobile App:
- Cannot directly use
<script>
tags in native apps. - Typically uses REST API (server-side) for security and consistency.
- Must manage
session_id
andcustomer_id
manually. - Handle click redirects with deep links or webviews.
- Cannot directly use
Best Practice: Use a unified server-side integration to feed both web and app.
4. Best Practices
- Phase Your Integration: Start with SDK for speed, then move to API for full features.
- Use Consistent IDs: Always send
marketplace_id
andsession_id
; includecustomer_id
when available. - Trigger Conversions Only on Confirmation: Fire
sale
events after payment success. - Load Ads Asynchronously: Avoid blocking UI threads.
- Use Explicit Placement Containers: Prevent layout shifts and ensure predictable ad placement.
- Leverage SDK Callbacks: Use
onRender
andonError
for analytics and fallback handling. - Whitelist Domains & Check Base URL: Prevent CORS issues.
- Respect Privacy & Consent: Pass consent flags and avoid sending PII without consent.
- Test with Live Campaign Data: Avoid confusion during testing.
- Monitor & Log Activity: Track
/ads
and/events
calls in production. - Keep SDK & API Updated: Use the latest versions.
5. Common Pitfalls
- Forgetting event tracking in API mode.
- Calling SDK methods before script load or DOM readiness.
- CORS misconfiguration (domain not whitelisted).
- Not handling ad load errors (
onError
). - Missing "Sponsored" labels (compliance issue).
- Misinterpreting viewability tracking delays.
- Not testing across browsers, devices, and screen sizes.
- Ignoring error logs from SDK/API responses.