Inventory script integration (Site)
This article is reviewing inventory script integration for sites.
Overview
Script integration connects website inventory to your account using JavaScript implementation. This method is ideal for publishers who implement ads directly on their web pages or through ad servers.
Step-by-Step Setup
Step 1: Create New Inventory
- Go to Inventory Module → List tab
- Click '+' button to create new inventory
Step 2: Configure General Settings
- Source: Select Site
- Fill required fields:
- Inventory name
- Associated business partner (optional)
- Max QPS and incoming request limits (optional)
- Integration Type: Select 'Script'
- Click 'Create'
Step 3: Access Script Wizard
Navigate to the Integration tab to access the script generation wizard.
Quick Access: Click integration type in 'Type' column from Inventory List for instant pop-up with script.

Script Configuration Wizard
1. Select Media Type
Choose the ad format your inventory will serve:
- Banner: Standard display ads
- Video: Video ad placements
- Native: Native advertising format
2. Configure Macros
Default macros are pre-selected for optimal script performance.
Macro management:
- Add additional macros using the macros select box
- Remove unnecessary macros if needed
- Recommendation: Keep default macros for best effectiveness
3. Copy Generated Script
Click 'Copy' icon to copy the generated JavaScript code
4. Add Placement ID (Required)
Locate this section in the script:
/*"placement": "PLACE YOUR PLACEMENT ID HERE",*/
Update to:
/* and */ comment marks and replace the placeholder with the actual placement ID.5. Add Passback (Optional)
If using ad server passback, locate this section:
/*To implement the passback remove the comment sign and replace it with your passback code:*/
/*"passback": "Example: <div> PASSBACK ADVERTISEMENT </div>"*/
Update to:
"passback": "<div>YOUR ACTUAL PASSBACK CODE HERE</div>"
Steps:
- Remove comment marks (
/*and*/) - Replace example code with your actual passback implementation
- Ensure the passback code is properly escaped for JavaScript
Implementation Steps for Publisher
Basic Implementation:
- Copy the generated script from the Integration tab
- Add placement ID to script
- Add passback code if needed
- Implement the script on the website where the ads should appear
- Test ad serving and passback functionality
Ad Server Implementation:
- Configure script in ad server (DFP, GAM, etc.)
- Replace macros with ad server macro equivalents
- Test passback chain functions correctly
Script Example Structure
<script type="application/javascript">
window.$gambid = {
"rtb": "https://rtb.gamoshi.io/r/[INVENTORY_ID]/bidr",
"bidParams": {
"adtype": "banner",
"adh": 250,
"adw": 300,
"bidfloor": 0.01,
"placement": "your-placement-id" // Add your placement ID
},
// Optional passback implementation
"passback": "<div>PASSBACK CODE</div>"
};
</script>
<script type="text/javascript" src="https://static.gambid.io/tag/latest"></script>
Best Practices
Script Configuration:
- Always include the placement ID for proper tracking
- Keep default macros unless you have specific requirements
- Test the script thoroughly before deploying to production
- Document any custom macro configurations
Passback Implementation:
- Only add the passback code if you're using an ad server fallback
- Ensure the passback code is properly formatted
- Test passback chain triggers correctly when no fill
- Verify passback doesn't create infinite loops
Testing:
- Implement the script on the test page first
- Verify that ads load and display correctly
- Test passback functionality (if implemented)
- Monitor the browser console for JavaScript errors
- Check the Analytics Module for traffic flow
Troubleshooting
Script not loading:
- Check the JavaScript console for errors
- Verify the script URL is correct and accessible
- Ensure no ad blockers are interfering with the script
Ads not appearing:
- Confirm the placement ID is added correctly
- Check campaigns are targeting this inventory
- Verify bid floors aren't set too high
- Review the browser console for bidding errors
Passback not working:
- Verify comment marks are removed
- Check the passback code syntax is valid
- Ensure passback doesn't contain conflicting scripts
- Test passback independently
Macro issues:
- Confirm all required macros are included
- Verify macro values are being populated
- Check ad server macros match script requirements
Advanced Configuration
Multiple Placements:
Create duplicate scripts with different placement IDs for each ad position on your site.
Custom Macros:
Add platform-specific macros for enhanced targeting and tracking capabilities.
Dynamic Parameters:
Use JavaScript variables to populate bid parameters dynamically based on page context.