BigCommerce
Install the widget on your BigCommerce store
Installing the Widget on BigCommerce
Overview
This guide will walk you through installing our JavaScript widget on your BigCommerce store. BigCommerce provides flexible options for adding custom code to your e-commerce site.
Method 1: Using Script Manager (Recommended)
Script Manager is BigCommerce's built-in tool for adding scripts site-wide or to specific pages.
Step 1: Access Script Manager
- Log in to your BigCommerce admin panel
- Navigate to Storefront → Script Manager
- Click Create a Script button
Step 2: Configure Script Settings
- Script Name: Enter a name (e.g., "My Widget Script")
- Description: Optional description for your reference
- Location on page: Select Footer
- Select pages where script will be added: Choose one of:
- All Pages (recommended for site-wide installation)
- Storefront pages
- Checkout pages
- Order confirmation page
- Specific page types
Step 3: Script Category
Select Essential or Analytics depending on your widget's purpose.
Step 4: Script Type
Select Script
Step 5: Add Your Widget Code
In the script contents box, paste your widget script:
<script src="https://your-domain.com/widget.js"></script>
<script>
YourWidget.init({
apiKey: 'YOUR_API_KEY'
});
</script>
Replace YOUR_API_KEY with your actual API key from your dashboard.
Step 6: Save
- Click Save button
- Your widget is now active on your store!
Method 2: Theme File Editing (Advanced)
For more control, you can edit your theme files directly.
Step 1: Access Theme Files
- Go to Storefront → Themes
- Find your active theme
- Click Advanced → Edit Theme Files
Step 2: Edit base.html or footer.html
- Navigate to templates → layout
- Click on base.html (or footer.html if available)
- Find the closing
</body>tag (usually near the bottom)
Step 3: Add Your Widget Script
Paste your widget script just before the </body> tag:
<!-- Your Widget Script -->
<script src="https://your-domain.com/widget.js"></script>
<script>
YourWidget.init({
apiKey: 'YOUR_API_KEY'
});
</script>
</body>
Replace YOUR_API_KEY with your actual API key.
Step 4: Save and Apply
- Click Save (or Save & Apply if available)
- If prompted, apply changes to your live store
Warning: Changes to theme files will be lost if you switch themes or update your theme. Use Method 1 (Script Manager) for a more permanent solution.
Method 3: Page Builder Widget
If using BigCommerce's Page Builder:
Step 1: Edit Page
- Go to Storefront → Web Pages
- Select the page you want to edit
- Click Edit in Page Builder
Step 2: Add HTML Widget
- Click where you want to add the widget
- Search for or select HTML widget
- Drag it onto your page
Step 3: Add Your Code
- Click on the HTML widget
- In the settings panel, paste your widget script:
<script src="https://your-domain.com/widget.js"></script>
<script>
YourWidget.init({
apiKey: 'YOUR_API_KEY'
});
</script>
- Replace
YOUR_API_KEYwith your actual API key - Click Save or outside the widget
Step 4: Publish
- Click Publish to make the page live
Note: This method only adds the widget to that specific page.
Installing on Specific Page Types
On Product Pages Only
Using Script Manager:
- In step 2, select Storefront pages → Product pages
- Follow the remaining steps
On Cart Page Only
Using Script Manager:
- In step 2, select Storefront pages → Cart page
- Follow the remaining steps
On Checkout Pages
Using Script Manager:
- In step 2, select Checkout pages
- Follow the remaining steps
Note: For security, some checkout page features may be limited.
On Order Confirmation Page
Using Script Manager:
- In step 2, select Order confirmation page
- Follow the remaining steps
Installing with Stencil Themes
For stores using Stencil themes:
Using Front Matter
Add to specific template pages by editing the page's front matter:
- Edit the template file (e.g.,
product.html) - Add to the front matter section:
{{#partial "page"}}
<script src="https://your-domain.com/widget.js"></script>
<script>
YourWidget.init({
apiKey: 'YOUR_API_KEY'
});
</script>
{{/partial}}
Using Stencil CLI
If developing locally:
- Edit your theme files
- Use
stencil pushto upload changes - Apply the updated theme
Troubleshooting
Widget Not Appearing
Check Script Manager:
- Go to Storefront → Script Manager
- Verify your script is Active (green toggle)
- Check page selection settings
Clear cache:
- BigCommerce uses CDN caching
- Wait 5-10 minutes for changes to propagate
- Use Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)
- Try incognito/private browsing
Verify consent manager:
- If you have a cookie consent manager, ensure scripts are allowed
- Check if your widget needs consent approval
Check browser console:
- Right-click → Inspect → Console tab
- Look for any error messages
- Share errors with our support team
Verify API key:
- Ensure you replaced
YOUR_API_KEYwith your actual key - Check for extra spaces or estimates
- Confirm key is correct in your dashboard
- Ensure you replaced
Script Manager Script Not Running
- Check the Script Category - try changing between Essential/Analytics
- Verify Location on page is set to Footer
- Ensure the script is enabled (toggle should be green)
- Check page selection matches where you're testing
Widget Appears Multiple Times
- You may have added the script in multiple places:
- Script Manager
- Theme files
- Page Builder widgets
- Remove duplicate installations
Widget Not Working on Checkout
- Checkout pages have security restrictions
- Some custom scripts may be limited
- Contact BigCommerce support to verify if your use case is allowed
- Consider adding to order confirmation page instead
Best Practices
- Use Script Manager (Method 1) for most cases - it's the easiest and most maintainable
- Select "Footer" placement for better page load performance
- Test in multiple browsers and devices
- Keep your API key secure - never expose it publicly
- Document your installation - note which method you used
BigCommerce Plan Compatibility
All BigCommerce plans support custom scripts:
| Feature | All Plans |
|---|---|
| Script Manager | ✅ Yes |
| Theme File Editing | ✅ Yes |
| Page Builder | ✅ Yes |
| Custom HTML | ✅ Yes |
Important Notes
⚠️ Theme Updates:
- Scripts in Script Manager persist through theme updates
- Scripts in theme files will be lost when updating/changing themes
- Always use Script Manager when possible
⚠️ CDN Caching:
- BigCommerce uses CDN caching
- Changes may take 5-10 minutes to appear
- Use incognito mode for immediate testing
⚠️ Stencil vs. Blueprint:
- Most modern stores use Stencil (recommended)
- Blueprint is legacy and being phased out
- This guide focuses on Stencil themes
Advanced Configuration
Loading Widget Based on Customer Login Status
<script>
{{#if customer}}
// Customer is logged in
var script = document.createElement('script');
script.src = 'https://your-domain.com/widget.js';
script.onload = function() {
YourWidget.init({
apiKey: 'YOUR_API_KEY',
customerId: '{{customer.id}}'
});
};
document.body.appendChild(script);
{{/if}}
</script>
Passing Product Data to Widget
On product pages:
{{#partial "page"}}
<script src="https://your-domain.com/widget.js"></script>
<script>
YourWidget.init({
apiKey: 'YOUR_API_KEY',
productId: '{{product.id}}',
productName: '{{product.title}}',
productPrice: '{{product.price.with_tax.value}}'
});
</script>
{{/partial}}
Testing Your Installation
Verification Steps
- Visit your storefront in a new browser tab
- Right-click and select Inspect or Inspect Element
- Go to Console tab
- Look for any errors related to your widget
- Go to Network tab
- Refresh the page
- Search for your widget script URL
- It should load with status 200 OK
Multi-Storefront Support
If you have multiple storefronts:
- Each storefront can have its own Script Manager scripts
- Add the widget to each storefront individually
- Or add to theme files that are shared across storefronts
Need Help?
If you encounter any issues:
- Check our FAQ at [your-support-url]
- Contact our support at [your-support-email]
- Include your BigCommerce store URL
- Mention your theme name if known
- Take screenshots of Script Manager settings and any errors
You can also contact BigCommerce Support:
- BigCommerce Help Center
- They can help with theme file editing and script issues
Removing the Widget
To remove the widget from your BigCommerce store:
If using Script Manager:
- Go to Storefront → Script Manager
- Find your widget script
- Click the ... (three dots) menu
- Select Delete
- Confirm deletion
If using Theme Files:
- Go to Storefront → Themes → Advanced → Edit Theme Files
- Navigate to the file where you added the script (e.g.,
base.html) - Find and delete the widget script
- Click Save
If using Page Builder:
- Edit the page containing the HTML widget
- Click on the HTML widget
- Delete the widget code or delete the entire widget
- Click Publish
Migration & Backup
- Always backup your theme before making changes
- Use the Download Theme File option before editing
- Consider creating a test store for trying new scripts
- Keep a copy of your widget code in a safe place
Quick Reference
Easiest Method: Script Manager (Method 1) Most Flexible: Theme File Editing (Method 2) Page-Specific: Page Builder (Method 3)
Remember: Script Manager is recommended for most users!