Skip to main content
Skip table of contents

BetterTreatments Widget

This page describes how a publisher can deploy the BetterTreatments CPC widget.

Quick Start

Copy this code into your page, into the place in your page that the ad should appear.

HTML
<div id="bettertreatments-wrapper"></div>
<script src="https://db.revoffers.com/widget/bettertreatments-default.js"
   data-target_selector="#bettertreatments-wrapper"
   data-source_id="2cece2c2-f70f-45ed-9a36-bc0c2cfcfb9a"
></script>

Configuring the Script

The default way to configure the script is by adding data- attributes to the <script> tag. You can add as many parameters as you need to. See below for the list of configuration parameters.

HTML
<script src="https://db.revoffers.com/widget/bettertreatments-default.js"
    data-configValue1="foo"
    data-configValue2="bar"
></script>

Alternatively, you can define a global object with your settings. This is desirable for certain tag-loaders, like Google Tag Manager’s async loader, where the <script> tag will be loaded asynchronously and might miss the parameters of the script tag itself.

HTML
<script>
window.bettertreatments_config = {
  // configuration goes here
}
</script>
<script async src="https://db.revoffers.com/widget/bettertreatments-default.js"></script>

You can also call the global initializer directly like this.

HTML
Include this in the <head> of the page:

  <script src="https://db.revoffers.com/widget/bettertreatments-default.js"></script>

Then put this in the body:
  
  <div id="my-custom-div"></div>
  <script>
  bettertreatments_init(document.getElementById("my-custom-div"), {
   // configuration goes here
  })
  </script>

Available Configuration Values

Key Name

Type

Note

height

Dimension string

When set, will provide an explicit height for the container div. Default value: 100%

We recommend specifying this so the widget appears correctly within your layout, since the default value may cause issues on your website.

width

Dimension string

When set, will override the width of the container div. The default is typically fine for most placements. Default value: 100%

extraParams

URLSearchString formatted string

Passes additional URL parameters to the widget. By default the current page’s query string will be forwarded. This value enables you to add additional.
Example: utm_medium={my_campaign}&src=22828

target_selector

DOM Selector string

When defined, you must have this element on the page. This skips any styling customizations for the wrapper container, giving you more control.

source_id

Campaign ID string

The traffic source identifier, created and managed within the Katalys CPC Marketplace. This is unique to your publisher account.

How the Script Works

The script creates an <iframe> element inside of your div. The iframe is pointed to the domain glp1help.bettertreatments.org. The URL of the Iframe will include:

  1. The base URL https://glp1help.bettertreatments.org/?

  2. The query-string parameters you pass via the configuration parameter extraParams

  3. The query-string parameters of the currently-viewed webpage

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.