You can modify the last number of the
ados_add_placement() function to serve multiple ad sizes in a slot. For instance:
ados_add_placement(23, 6872, "azk66721", [5,4,6])
This looks for an ad to show in any of those sizes (300x250, 728x90, 160x600) and resizes the div accordingly.
To learn which numbers your ad sizes are, generate ad code for those sizes first. Then, copy the numbers into a single
ados_add_placement() line when you add the ad tags to your page. Be sure to separate the numbers by commas, and contain them in brackets.
To reload your ads or refresh after the page has already loaded, add
.setRefresh() to the
ados_add_placement function. Inside the parentheses, put the number of seconds before the ad is to change to a new ad. In the example below, "15" is 15 seconds:
ados_add_placement(650, 16803, "azk70681", 6).setZone(3055).setRefresh(15);
The default refresh rate is 10 seconds, and the minimum refresh rate is 1 second. If you enter 0, null, or a number less than 1, we will refresh every 10 seconds.
You can also add the
ados_refresh() function to the script to have greater control of how your ad refreshes:
ados_refresh('azk70681', 15, false)
15 is the number of seconds until the next refresh, and true/false indicates whether to refresh the ad again after the initial refresh.
true as in the example below:
To refresh companion ads, modify the following refresh code and add it below your ad code.
ados_add_placement lines should be copy and pasted from the original ad code. The
getElementById identifications must match the
<div> IDs for the ads being refreshed. The
5000 denotes the number of milliseconds between each ad refresh.
To serve a flight that is targeted to certain keywords, add the keywords after the ad placement code with
ados_add_placement(650, 16803, "azk70681", 6).setZone(3055); ados_setKeywords('dodge, truck, SUV');
Separate each keyword with a comma, and enclose in single brackets.
ados_setKeywords(); to your ad tags will set keywords for the entire ad request (which includes all of the placements called in the ad tags). This means that if you set a keyword for one placement, all of the placements in the tags will also be set for that keyword. To target a specific placement with a keyword, use multiple sets of ad tags, or add
ados_load(); after each placement you need to set with a keyword. To set no keyword at all, use
ados_setKeywords(""); after the placement.
To add keywords to Email ad code, append the keywords to the end of the
<img> tag, using
<img border="0" src="https://e-<networkId>.adzerk.net/s/14889/0/4/89011487?keywords=keyword1,keyword2,keyword3"; />
You can rename the div generated in the ad code, but the new name must match in both the script section and the
ados_add_placement(650, 16803, "above_the_fold_160", 6).setZone(3055);
Below are instructions on how to manually serve specific campaigns, flights, or creatives. You can also use generate ad code automatically by selecting "Generate Ad Code" in the Tools dropdown next to a creative, flight, or campaign.
To serve specific campaigns, flights, or creatives:
- Generate 3rd Party Ad Server code
- Find the ID of the campaign, flight, or ad you want to serve. You can find these in the Campaigns --> Campaigns or Flights or Ads tabs
- Modify the ad code to set the ID you want to serve
- For a campaign, include
ados_add_placement(650, 16803, "azk70681", 6).setZone(3055).setCampaignId(7883);
- For a flight, include
ados_add_placement(650, 16803, "azk70681", 6).setZone(3055).setFlightId(17814);
- For a creative, include
ados_add_placement(650, 16803, "azk70681", 6).setZone(3055).setFlightCreativeId(29052);
You can modify a placement to make it eligible to serve ads targeted to multiple zones:
ados_add_placement(650, 16803, "azk70681", 6).setZone(3055,3056,3057).setCampaignId(7883);
Use a comma to separate the zone IDs.
If a flight without zone targeting is served by a placement with multiple zones, we will only record the impression and click etc. for the first zone listed in the placement.
You should always use https to call Kevel's APIs and ad code. Older ad codes may not use https - those should be updated to use https only.
Ad code generated after February 3, 2020 serves to secure pages (https) only. Ad code generated before then should be updated to use https.
Kevel's older Standard ad code automatically chose which protocol to use, so as long as you load the ad code from an https page, you won't need to modify anything.
If older Kevel Standard code is loaded from an http page, it will stop working. Instead, load the ad code via https.
If you're using Kevel's Synchronous, Email, or 3rd Party Ad Server ad code, you will need to make one simple change. After generating ad code, you'll see the ad request is in
http:// format, like this:
Change this request to:
and your ads will serve correctly.
To track clicks on a third-party server (like DFP), insert the server's click tracking macro in the
.setRedirectURL() field in the 3rd Party Ad Server type ad code:
ados_addInlinePlacement(1613, 15404, 4).setRedirectUrl('-optional-click-macro-').loadInline();
Enclose the click tracking macro within the single quotation marks:
ados_addInlinePlacement(1613, 15404, 4).setRedirectUrl('%%CLICK_MACRO_HERE%%').loadInline();
By default, Kevel's ados.js ad tags will assign a random, unique UserKey to each user making a request. To pass in a permanent UserKey, you will need to add the following function to the ad call:
ados_setUser("unique user ID");
Instead of using a browser's default user agent string, you can pass in a user agent of your choice:
ados_setUserAgent("full user agent string");
You can override the IP address of the request. Note that the IP address must be valid, or else the request will fall back to the address of the originating server.
ados_setIp("valid IP address");
You can set custom accessibility tags in the ad response by using the
ados_setAccessibility function. This can write:
The ad iframe's title
The ad iframe's language attribute
Alt text for the impression pixel (i.gif)
The default values for the accessibility attributes are empty. Setting accessibility tags creates new values instead of overriding them.
You can set your user's data consent preferences on an ados.js request. For example, setting GDPR data tracking consent for European Union users looks like this:
Note that GDPR consent defaults to
false if it is not explicitly set to
GDPR consent settings use the boolean
true, not the string
A full list of data consent settings is found in the GDPR documentation.
Dynamic site selection is an ad code modification that automatically sets the
SiteId for the ad code based on the domain where the tags are hosted. This feature can be used two ways:
- Dynamic site tags prevent tags from serving on unauthorized domains. If dynamic site tags are served on a page whose domain isn't a Site in the originating network, the ad call will not complete, and no ads will be served.
- Dynamic site tags let a publisher or network with many separate Sites use the same tags across all their sites with no modifications to the ad code. Standard ad tags require a unique SiteId for every site in a network, or impression and click data will not be tracked for individual sites. Dynamic site tags will track clicks and impressions for multiple sites, while using the same ad tags for each.
To use dynamic site selection:
- Make sure that every domain you intend to use the tags for has been created as a Site in your network. Note that subdomains will be counted as a separate site.
- Generate ad tags for the intended Ad Size and Zone on the Ad Code page.
- To prevent the tags from serving to unknown domains, modify the SiteId (the middle number in the
0, or, modify the
ados_addInlinePlacement();function in the 3rd Party Ad Server tags.
- To allow the tags to fallback to a default site if the domain is unknown, modify the placement function with the siteId of the fallback site. Any clicks and impressions from the unknown domain will be recorded as coming from the default site.
- Append the method
enableDynamicSiteSelection()to the end of the function.
Once modified, your function will look like this:
ados_add_placement(1613, 0, "azk96446", 1).enableDynamicSiteSelection();
ados_addInlinePlacement(1613, 0, 1).enableDynamicSiteSelection().loadInline();
Your tags are now ready to be used on a page. If you're using 3rd Party Ad Server tags, make sure the
.loadInline(); method is the last on the function to enable the ad to load.
Updated about a month ago