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

These configuration parameters customize how the script works. They can be defined as object key-values, or as data- attributes on the <script> tag.

Key Name

Type

Note

target_selector REQUIRED

DOM Selector string

Tells the script where to build the widget. The selector must resolve to an element on the page. This skips any styling customizations for the wrapper container, giving you more control.

source_id REQUIRED

Campaign ID string

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

height RECOMMENDED

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%

logo_url

URL

A publicly available URL to your logo. The logo will replace the default logo. It will be centered/resized using CSS to be compatible with desktop and mobile. It must be a .png, .jpg, or .svg – we recommend using an SVG for best quality.

extraParams

URLSearchString formatted string

Passes additional URL parameters to the widget. By default the current page’s query string will be forwarded – this is likely the most beneficial result. This exists for testing purposes, or if you need to override the current query string with custom values.
Example: utm_medium={my_campaign}&src=22828

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.