Embeddable AI Widget
Embed Tax Nigeria's intelligent tax assistant directly into any website, web portal, or SaaS application with a single script tag.
Embeddable Tax Nigeria AI Widget
The Tax Nigeria Chat Widget allows businesses, fintechs, payroll providers, and accounting firms to embed Nigeria's leading tax intelligence agent onto any web page or SaaS application.
The widget is lightweight (under 15KB gzipped), requires zero third-party dependencies, runs asynchronously, and provides instant answers grounded in current Nigerian tax legislation (including the Nigeria Tax Act 2025/2026, CITA, PITA, VAT, and WHT regulations).
Looking for an interactive playground? Test brand colors, positions, greetings, and starter questions live with our Interactive Widget Playground & Demo.
Key Capabilities
- Instant 1-Line Drop-In: Add a single
<script>tag before your closing</body>tag to activate the assistant. - Dual Operation Pathways: Choose between instant Anonymous Drop-In (zero setup) or Registered Dashboard Widgets (domain-whitelisted with custom quotas).
- Grounded Nigerian Tax Knowledge: Pre-trained and retrieval-augmented across Personal Income Tax (PAYE), Company Income Tax (CIT), Value Added Tax (VAT), and Withholding Tax (WHT).
- Brand Customization: Customize primary brand colors, header titles, welcome greetings, and screen position (
bottom-rightorbottom-left). - Custom Starter Prompts: Guide your users with industry-specific starter questions (for Payroll, Fintech, Real Estate, or E-commerce).
- Proactive Nudge Bubble: Automatically presents a non-intrusive floating speech bubble to invite visitor engagement.
- Programmatic JavaScript API: Open, close, toggle, or update questions dynamically via
window.TaxNGWidget. - Cross-Frame Lifecycle Events: Listen for load, expand, collapse, and theme changes via standard HTML5
window.addEventListener('message').
Integration Modes: Anonymous vs Registered
The Tax Nigeria Widget provides two distinct operating modes designed to balance frictionless testing with enterprise security:
| Feature | Mode 1: Anonymous Drop-In | Mode 2: Registered Dashboard Widget |
|---|---|---|
| Setup Required | None. Copy and paste script tag. | 1-minute registration in Settings. |
| Widget ID | Not needed | data-widget-id="wid_live_..." |
| Domain Locking | Open (works on any website) | Origin & Referer Whitelist (blocks unauthorized hotlinking) |
| Visitor Daily Quota | Fixed at 5 questions / visitor / day | Configurable (15 to 100 questions / visitor / day) |
| Appearance Management | Static HTML data-* attributes | Remote Dashboard Studio (updates live without redeploying) |
| Query Telemetry | Local to visitor browser | Aggregated query counters in your dashboard |
| Best For | Prototypes, staging, internal wikis | Production SaaS, fintech apps, company portals |
Mode 1: Anonymous Drop-In (Zero Setup)
The Anonymous Drop-In mode is the fastest way to get started. You do not need to register an account or configure any backend credentials.
How It Works
- Add the public script tag to your web page HTML.
- Your visitors receive 5 free tax calculations and legal queries per 24 hours (tracked fairly per visitor IP and device).
- Configure branding, titles, and starter questions statically using HTML
data-*attributes.
Code Examples (Mode 1)
<!-- Place before closing </body> tag -->
<script
src="https://taxnigeria.ng/widget/taxng-widget.js"
data-position="bottom-right"
data-primary-color="#066738"
data-title="Tax Nigeria Assistant"
data-greeting="Hello! Ask any question regarding PAYE, CIT, or VAT."
data-nudge="true"
></script>Mode 2: Registered Dashboard Widget (Domain-Protected)
Mode 2 is recommended for all production websites, client portals, and SaaS platforms. It attaches your unique data-widget-id to protect your platform against unauthorized embedding and provides deep control over styling and visitor limits.
Why Register Your Widget?
- Domain Whitelisting (Anti-Hotlinking): Only authorized domains (e.g.
acmepayroll.ng,app.mycompany.com,localhost:3000) can initialize your widget. Unauthorized third parties attempting to copy your embed tag onto their own websites will receive HTTP 403 Forbidden. - Higher Visitor Allowances: Increase the daily visitor question limit from the default 5 up to 100 questions per visitor per day.
- Live Remote Styling: Change brand colors, titles, greetings, launcher position, and starter prompts directly in your dashboard without touching your codebase or deploying changes.
- Instant Pause / Resume: Deactivate a live widget immediately from your dashboard if needed.
Registration Steps
Open Settings in Tax Nigeria
Log in to your Tax Nigeria Workspace, click Settings in the sidebar, and select Embeddable Widgets.
Click Register Widget
Click the + Register Widget button to launch the Widget Studio.
Configure Security & Brand Appearance
- Widget Name: Give your widget an identifiable label (e.g. "Main Marketing Portal" or "Payroll App").
- Allowed Domains: Enter your production domains, staging domains, and
localhost:3000(one per line). Subdomains and wildcards (*.yourcompany.com) are fully supported. - Daily Question Limit: Choose how many queries each visitor can ask per day (e.g. 15, 25, 50, or 100).
- Brand Styling: Choose your brand color, position (
bottom-rightorbottom-left), welcome headline, and up to 6 custom starter questions. - On mobile devices, use the Live Preview toggle to inspect the exact look and feel before saving.
Copy Your Embed Code
Click Register Widget. Your unique data-widget-id (such as wid_live_8f3a9e12) will be generated. Copy the snippet and paste it into your application.
Code Examples (Mode 2)
<!-- Place before closing </body> tag -->
<script
src="https://taxnigeria.ng/widget/taxng-widget.js"
data-widget-id="wid_live_8f3a9e12"
></script>HTML Data Attributes Reference
When using Mode 1 (Anonymous) or overriding settings locally in Mode 2, use the following data-* attributes on the <script> tag:
| Attribute | Type | Default | Description |
|---|---|---|---|
data-widget-id | string | (Optional) | Your registered widget ID (e.g. wid_live_...). Activates Mode 2 with domain security and remote styling. |
data-mode | "chat" | "redirect" | "chat" | "chat" opens the embedded AI window. "redirect" opens data-redirect-url in a new browser tab upon click. |
data-position | "bottom-right" | "bottom-left" | "bottom-right" | Screen anchor location for the launcher button and chat window. |
data-primary-color | string (hex) | "#066738" | Primary brand color applied to the floating button, send button, and accents. |
data-title | string | "Tax Nigeria Assistant" | Title displayed in the chat window header. |
data-greeting | string | "" | Welcome headline shown above starter questions on initial open. |
data-subtitle | string | "" | Secondary description displayed directly below the greeting. |
data-starter-prompts | JSON | string | "" | List of starter questions. Supports JSON arrays or pipe-separated strings. |
data-nudge | "true" | "false" | "true" | Controls whether the proactive floating speech bubble appears next to the launcher button. |
data-nudge-text | string | "Have questions on Nigerian tax? Ask here" | Prompt text shown inside the floating nudge bubble. |
data-redirect-url | string (URL) | "https://taxnigeria.ng" | Target destination URL when data-mode="redirect". |
data-z-index | string | number | "999999" | Custom CSS z-index for the widget to ensure it floats above your site navigation. |
Custom Starter Prompts
Starter prompts allow you to suggest relevant questions tailored to your user demographic. You can configure them in the dashboard (Mode 2) or supply them via script tag attributes (Mode 1).
Option A: JSON Array Syntax
<script
src="https://taxnigeria.ng/widget/taxng-widget.js"
data-mode="chat"
data-starter-prompts='[
"What are the WHT rates on software contracts?",
"How does VAT apply to digital services in Nigeria?",
"Can you compute PAYE for remote staff in Lagos?"
]'
></script>Option B: Pipe-Separated Syntax
<script
src="https://taxnigeria.ng/widget/taxng-widget.js"
data-mode="chat"
data-starter-prompts="What is Withholding Tax? | How do I register for VAT? | What are the 2026 PAYE bands?"
></script>JavaScript Programmatic API
Control the widget from your own navigation bars, CTA buttons, or customer support links via the global window.TaxNGWidget object.
| Method | Arguments | Description |
|---|---|---|
window.TaxNGWidget.open() | None | Opens the chat window and displays conversation history. |
window.TaxNGWidget.close() | None | Collapses and hides the chat modal. |
window.TaxNGWidget.toggle() | None | Toggles the open / collapsed state. |
window.TaxNGWidget.setMode(mode) | "chat" | "redirect" | Dynamically switches click behavior between chat and external redirect. |
window.TaxNGWidget.setStarterPrompts(prompts) | string[] | string | Dynamically updates the starter questions without reloading the page. |
Example: Binding to a Custom Support Button
// Attach to a custom "Ask Tax Specialist" button in your navbar
document.getElementById('nav-tax-help-btn').addEventListener('click', () => {
if (window.TaxNGWidget) {
window.TaxNGWidget.setStarterPrompts([
"Explain the tax deductions for this invoice",
"What is the applicable VAT rate in Nigeria?",
"How to remit withholding tax to FIRS"
]);
window.TaxNGWidget.open();
}
});Cross-Frame Lifecycle Events (postMessage)
The host page can listen for lifecycle events emitted by the embedded chat iframe using the standard HTML5 window.addEventListener('message') interface:
window.addEventListener('message', (event) => {
if (!event.data || typeof event.data !== 'object') return;
switch (event.data.type) {
case 'taxng-widget:ready':
console.log('Tax Nigeria Widget is fully initialized and ready');
break;
case 'taxng-widget:close':
console.log('User closed or collapsed the chat widget');
break;
case 'taxng-widget:expand':
console.log('Widget expansion state changed:', event.data.expanded);
break;
case 'taxng-widget:theme-change':
console.log('Widget theme switched to:', event.data.theme);
break;
}
});Security & Domain Whitelisting
Origin & Referer Verification
In Mode 2, every configuration fetch and chat stream verifies the Origin and Referer request headers against your allowed domains list.
- If a request originates from an unlisted website, the API responds with HTTP 403 and the widget displays a polite notice.
- Whitelist patterns support exact root domains (
acmepayroll.ng), explicit ports (localhost:3000), and wildcard subdomains (*.acmepayroll.ng).
Content Security Policy (CSP)
The widget endpoint transmits framing headers allowing embedding across all standard HTTPS origins:
Content-Security-Policy: frame-ancestors 'self' * https: http:;Local Development Notice
Modern web browsers enforce strict security policies for local file:/// URLs that prevent cross-origin iframe communication. When testing locally, always run a local HTTP development server (such as localhost:3000, npx serve, Vite, or VS Code Live Server) rather than opening HTML files directly from disk.