# Traffic source: HasOffers
HasOffers is one of the oldest and well-known platforms.
Preparing a Landing Website
Our aim is to save a {subid} into a session and send a postback after an action when the website gets traffic from Keitaro.
- Set a code of saving a {subid} parameter into a session on a page where you plan to transfer traffic to.
<?php
if (!headers_sent() && !session_id()) {
session_start();
}
if (isset($_GET['subid'])) {
$_SESSION['subid'] = $_GET['subid'];
}
?>
2
3
4
5
6
7
8
- After a user makes an action, for example signs up, we have to send a postback. The postback is sent via a call to Keitaro postback address with sending necessary parameters:
<?php
$url = 'http://POSTBACK_URL?cost=1&status=registratered&sub_id_1=game1&subid=' . urlencode($_SESSION['subid']);
file_get_contents($url);
?>
2
3
4
Write your Postback URL, which you can get in Keitaro in the Maintenance → Postback URL menu instead of the POSTBACK_URL
.
Parameters "cost" and "sub_id_1" are added as an example of additional information you can send to Keitaro. Later, you'll be able to see all information in reports.
Pay special attention to "status" and "subid" parameters. Status transfers the identification of an action, for example lead, sale, rebill, rejected. In this case, we transferred "registration", is a "lead" for Keitaro.
# Setting up a landing page
A campaign must be set up with a HasOffer as a source and must have one flow leading to a landing.
Add your website as a landing on a Landing Pages page. Fill in the name, URL, and Redirect as a loading method. Add ?subid={subid}
to the URL.
# Adding traffic source
Add a new traffic source on a Source page. Choose the "Hasoffers.com" template.
Go to the Campaigns page, press Create.
Fill in the name, choose Hasoffers.com as a source, select CPA as a cost model.
Create a Flow, choose Landing Pages and Offers in a schema tab and add your landing page as an offer:
Copy the campaign's link, we will need it a bit later.
# Adding an offer to HasOffers
In a CPA network go to Offers → Create offer.
Fill in the following fields:
- Name: the name of the offer.
- Preview URL — your website address.
- Default Offer URL — paste a tracking link we copied earlier on a Campaign page.
- Conversion Tracking — choose Server Postback w/Transaction ID.
Next, you can add a conversion cost, targeting, and other parameters.
Go to the Offers page and click your offer.
- Find the CONVERSION POSTBACK URL part and Postback URL field. Pay attention to a domain and an offer_id. You will need them in step 6.
Open Keitaro, then Sources, edit the traffic source.
Change a domain and an OFFER_ID in a Postback URL field. Leave only sending leads in statuses.
# Testing
HasOffers gives you a link for testing, click it.
- Fill the action for to trigger a postback.
- Open Maintenance → Logs → Received postbacks and check if Keitaro receive postbacks.
- Open Maintenance → Logs → S2S postbacks and check if Keitaro sends postbacks. You may have to wait for 1-5 minutes until Keitaro sends the S2S postback.
The result is "Response: success=false; err_msg=Invalid Trans. ID #test1.;" because of a test link. You won't find this in real traffic.