Overview
If you have a non-WordPress site and would like to install Raptive’s ads yourself, you'll find the instructions for implementation below.
Here are the steps we will need you to take to get your new Raptive ads up and running:
- Remove all of your old ads and ads.txt file.
- Install our head tag into the <head> of your site across all pages.
- Set up a redirect from your old ads.txt file to your new Raptive ads.txt file.
- Install additional scripts for optimal performance
Once all 4 steps are completed, your ads can start earning for you! So let's get started!
Step 1: Remove your old ads
First, you'll need to go in and remove all of your old ad code and the ads.txt file.
Step 2: Head code installation
Our head code is placed in the <head> section of your site. It’s a critical part of how Raptive’s ad technology operates, particularly for header bidding and ad tag management. It connects your site to Raptive’s ad platform and:
- Enables auction calls, user syncs, and ad slot definitions.
- Ensures that ads and bidder scripts initialize before the page is rendered, hence “head” (since it lives in the <head> tag).
To install your new ads, you'll need to add this code to the <head> of your site. We’ll provide you with your unique head code; however, the following is an example with generic values.
<!-- Raptive Head Tag Manual -->
<script data-no-optimize="1" data-cfasync="false">
(function(w, d) {
w.adthrive = w.adthrive || {};
w.adthrive.cmd = w.
adthrive.cmd || [];
w.adthrive.plugin = 'adthrive-ads-manual';
w.adthrive.host = 'ads.adthrive.com';var s = d.createElement('script');
s.async = true;
s.referrerpolicy='no-referrer-when-downgrade';
s.src = 'https://' + w.adthrive.host + '/sites/[SITE ID]/ads.min.js?referrer=' + w.encodeURIComponent(w.location.href) + '&cb=' + (Math.floor(Math.random() * 100) + 1);
var n = d.getElementsByTagName('script')[0];
n.parentNode.insertBefore(s, n);
})(window, document);
</script>
<!-- End of Raptive Head Tag -->Step 3: Ads.txt setup
Advertisers require sites to have a file in the root called ads.txt that lists out where they can buy advertising on a specific site to prevent ad fraud.
- We will need you to set up a 301 redirect so your ads.txt points to our server. The great thing about this setup is that your ads.txt will always be up-to-date with our newest high-paying bidders! Here is the redirect info:
-
DOMAIN.COM/ads.txt 301 Redirect to https://ads.adthrive.com/sites/SITEID/ads.txt
- Note: These are example links; we replace the domain.com and SITEID for each creator during the install process
-
DOMAIN.COM/ads.txt 301 Redirect to https://ads.adthrive.com/sites/SITEID/ads.txt
Step 4: Additional Scripts
We have a couple of additional scripts that we'd love to install to optimize your performance here at Raptive.
- Ad Block Recovery: Our Ad Block Recovery setting attempts to load your ad layout for readers who use ad blockers, allowing you to recapture ad revenue from these pageviews. We'll provide you with a script to enable this feature.
- Link ID: Our Email Link ID helps creators earn higher CPMs by retaining and refreshing email identities from subscribers when they click links. Paste the code below into the head of your site:
<!-- START email detection/removal script -->
<script>
!function(){"use strict";const t={adt_ei:{identityApiKey:"plainText",source:"url",type:"plaintext",priority:1},adt_eih:{identityApiKey:"sha256",source:"urlh",type:"hashed",priority:2},sh_kit:{identityApiKey:"sha256",source:"urlhck",type:"hashed",priority:3}},e=Object.keys(t);function i(t){return function(t){const e=t.match(/((?=([a-z0-9._!#$%+^&*()[\]<>-]+))\2@[a-z0-9._-]+\.[a-z0-9._-]+)/gi);return e?e[0]:""}(function(t){return t.replace(/\s/g,"")}(t.toLowerCase()))}!async function(){const n=new URL(window.location.href),o=n.searchParams;let a=null;const r=Object.entries(t).sort(([,t],[,e])=>t.priority-e.priority).map(([t])=>t);for(const e of r){const n=o.get(e),r=t[e];if(!n||!r)continue;const c=decodeURIComponent(n),d="plaintext"===r.type&&i(c),s="hashed"===r.type&&c;if(d||s){a={value:c,config:r};break}}if(a){const{value:t,config:e}=a;window.adthrive=window.adthrive||{},window.adthrive.cmd=window.adthrive.cmd||[],window.adthrive.cmd.push(function(){window.adthrive.identityApi({source:e.source,[e.identityApiKey]:t},({success:i,data:n})=>{i?window.adthrive.log("info","Plugin","detectEmails",`Identity API called with ${e.type} email: ${t}`,n):window.adthrive.log("warning","Plugin","detectEmails",`Failed to call Identity API with ${e.type} email: ${t}`,n)})})}!function(t,e){const i=new URL(e);t.forEach(t=>i.searchParams.delete(t)),history.replaceState(null,"",i.toString())}(e,n)}()}();
</script>
<!-- END email detection/removal script -->