configure
Overview
Section titled “Overview”The configure method sets up Htag with configuration data from the server. This method is typically called automatically when using the Adconsole-connected version of Htag.
Example
Section titled “Example”window.htag.api('1').configure({ tag: { errors: [], tag: { id: 'website-123', websiteName: 'Example News', awaitTcLoaded: true, defaultCurrency: 'USD', disableRules: [], floorRules: [], publisherCompanyIds: ['123'], rawScripts: [], dynamicPlacements: [], placements: [], bidderSupplyChains: [], supplyChains: [], }, }, excludedMediations: { errors: [], creativeIds: [], }, exchangeRates: { errors: [], rates: { USD: 1, EUR: 0.85, CHF: 0.92, }, },});Parameters
Section titled “Parameters”The configure method accepts a single object with the following structure:
An object containing the main configuration for the Htag instance.
- errors (string[]): An array of error messages from the server.
- tag (object): An object containing the tag configuration.
- id (string): Website identifier.
- websiteName (string): Name of the website.
- awaitTcLoaded (boolean): Whether to wait for the CMP to load before initializing Htag.
- defaultCurrency (string): Default currency for bid values (e.g., “USD”).
- disableRules (object[]): Rules for disabling Htag in certain conditions.
- floorRules (object[]): Price floor rules.
- publisherCompanyIds (string[]): IDs used for Semantiq integration.
- rawScripts (object[]): Custom JavaScript to execute.
- dynamicPlacements (object[]): Dynamic placement configurations.
- placements (object[]): Static placement configurations. These are automatically processed by the definePlacements callback.
- bidderSupplyChains (object[]): Supply chain information for specific bidders.
- supplyChains (object[]): General supply chain information.
excludedMediations
Section titled “excludedMediations”An object containing information about excluded mediations.
- errors (string[]): An array of error messages from the server.
- creativeIds (string[]): List of creative IDs that should win the auction when present.
exchangeRates
Section titled “exchangeRates”An object containing currency exchange rates.
- errors (string[]): An array of error messages from the server.
- rates (object): Object mapping currency codes to exchange rates relative to the default currency.
Return Value
Section titled “Return Value”Returns the Htag API object, allowing for method chaining.
Placement Processing
Section titled “Placement Processing”When the configure method is called with placement data in the tag.placements array, the definePlacements callback is automatically invoked to process each placement configuration.
// Example showing placements being processed automaticallywindow.htag.api('1').configure({ tag: { placements: [ { elementId: 'header-ad', keywords: [ { key: 'section', values: ['header'] }, { key: 'premium', values: ['true'] }, ], // ... other placement config }, ], },});// definePlacements callback is called automatically with the placements arrayRelated Methods
Section titled “Related Methods”- definePlacements: The callback method that processes placement configurations
- definePlacement: Define individual placements manually
Related Concepts
Section titled “Related Concepts”- Dynamic Placements: Learn about dynamic placement configuration.
- Priority Creative IDs: Learn about excluded mediations.
- Placements: Learn more about placement configuration including bulk definition.