Skip to content
English
  • There are no suggestions because the search field is empty.

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

  1. Go to Inventory ModuleList tab
  2. Click '+' button to create new inventory

Step 2: Configure General Settings

  1. Source: Select Site
  2. Fill required fields:
    • Inventory name
    • Associated business partner (optional)
    • Max QPS and incoming request limits (optional)
  3. Integration Type: Select 'Script'
  4. 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.

Screen Shot 2023-05-15 at 11.15.59

 

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:

/*To implement the next section remove the comment sign and replace it with your placement ID:*/
/*"placement": "PLACE YOUR PLACEMENT ID HERE",*/ 
 

Update to:

 "placement": "your-actual-placement-id",
 
Important: Remove the /* 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:

  1. Remove comment marks (/* and */)
  2. Replace example code with your actual passback implementation
  3. Ensure the passback code is properly escaped for JavaScript
 

 

Implementation Steps for Publisher

Basic Implementation:

  1. Copy the generated script from the Integration tab
  2. Add placement ID to script
  3. Add passback code if needed
  4. Implement the script on the website where the ads should appear
  5. Test ad serving and passback functionality

Ad Server Implementation:

  1. Configure script in ad server (DFP, GAM, etc.)
  2. Replace macros with ad server macro equivalents
  3. 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:

  1. Implement the script on the test page first
  2. Verify that ads load and display correctly
  3. Test passback functionality (if implemented)
  4. Monitor the browser console for JavaScript errors
  5. 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.