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.
<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.
<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.
<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.
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 |
|---|---|---|
| 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. |
| Campaign ID string | The traffic source identifier, created and managed within the Katalys CPC Marketplace. This is unique to your publisher account. |
| Dimension string | When set, will provide an explicit height for the container div. Default value: We recommend specifying this so the widget appears correctly within your layout, since the default value may cause issues on your website. |
| Dimension string | When set, will override the width of the container div. The default is typically fine for most placements. Default value: |
| 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 |
| 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. |
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:
The base URL
https://glp1help.bettertreatments.org/?The query-string parameters you pass via the configuration parameter
extraParamsThe query-string parameters of the currently-viewed webpage