Home > Paid Traffic Sources > Mobile

Multiple Postback URL's (17)


09-20-2012 03:52 AM #1 deondup (Member)
Multiple Postback URL's

While HasOffers allow you to place multiple postback's, does anyone know how you can do it if your network only allows you to place 1?

If you run the same Neverblue offer (for example) on multiple traffic sources, is there a way to post the conversion to multiple traffic sources with different tracking tokens?


09-20-2012 04:53 AM #2 zeno (Administrator)

Yes. Basically all you need to do is pass a subid to identify the traffic source and a tracking id for conversions.

So, say you have a neverblue link - pass the traffic source identifier as e.g. subid2 (use say goog, fb, pof). Pass the tracking token for the traffic source under subid3. Change your postback to be http://yourserver.com/tracking.php?source={subid2}&token={subid3}. Now what we want our script on our server to do is receive that postback, look at the source value i.e. is it from google, FB or PoF? And then fire off the corresponding pixel for that tracking source with the tracking token {subid3} attached. Here is how you might do that, i.e. the contents of tracking.php:

[PHP]
<?
$source = $_GET['source']; //traffic source
$token = $_GET['token']; //tracking token

// postback based on traffic source in $source
if ($source = 'fb'):
$r = new HttpRequest('http://trackingpixel1.com/index.php?something='.$token, HttpRequest::METH_GET);
// send request
try {
$r->send();
if ($r->getResponseCode() == 200) {
// do nothing, this means the conversion has been counted properly
}
} catch (HttpException $ex) {
// do nothing or log that the call failed
}
elseif ($source = 'pof'):
$r = new HttpRequest('http://trackingpixel2.com/index.php?something='.$token, HttpRequest::METH_GET);
try {
$r->send();
if ($r->getResponseCode() == 200) {
}
} catch (HttpException $ex) {
}
elseif ($source = 'goog'):
$r = new HttpRequest('http://trackingpixel3.com/index.php?something='.$token, HttpRequest::METH_GET);
try {
$r->send();
if ($r->getResponseCode() == 200) {
}
} catch (HttpException $ex) {
}
endif;
?>
[/PHP]

You will need to edit the httprequest obviously to be in the correct format for your next postback to whatever platform. Definitely test that it works yourself by manually loading the tracking script with souce and token values in the URL to see that it fires conversions over to the other side. Enjoy.


09-20-2012 05:50 AM #3 deondup (Member)

^^^ Thanks a million!


09-21-2012 09:41 PM #4 nissangtr (Member)

That is awesome.


09-23-2012 03:43 AM #5 hd2010 (Member)

@zeno : what does HttpRequest do ? is it a class ?


09-23-2012 09:19 AM #6 zeno (Administrator)

Dunno, maybe? I didn't write the code myself, just modified it to suit. As far as I understand it, HttpRequest is a large class and one of the function you can use is HttpRequest::send, which allows us to try and contact some other server, in this case a pixel URL. Then getResponseCode is added so that it check that the request worked (and if it didn't you could log it).


10-10-2012 03:14 PM #7 hd2010 (Member)

@zeno : $token holds the value of unique subid that uniquely identify each click ?


10-10-2012 03:37 PM #8 hd2010 (Member)

Hate "if else" welcome "switch case"

Code:
<?php
	
// The postback script for those CPA network which only allow postback pixel

$source = $_GET['source']; //traffic source
$token = $_GET['token']; //tracking token

// postback based on traffic source in $source
switch($source)
{
	// facebook
	case 'fb':
		$r = new HttpRequest('http://trackingpixel1.com/index.php?something='.$token, HttpRequest::METH_GET);
	break;
	
	// pof
	case 'pof':
		$r = new HttpRequest('http://trackingpixel2.com/index.php?something='.$token, HttpRequest::METH_GET);
	break;
	
	// google
	case 'goog':
		$r = new HttpRequest('http://trackingpixel3.com/index.php?something='.$token, HttpRequest::METH_GET);
	break;

	default:
		exit();
	break;	
}	

// send request
try {
    $r->send();
    if ($r->getResponseCode() == 200) {
        // do nothing, this means the conversion has been counted properly
    }
} catch (HttpException $ex) {
        // do nothing or log that the call failed 
}

?>


10-10-2012 03:46 PM #9 hd2010 (Member)

@zeno : just wish to clear some confusion I had, for the postback portion, does the postback traffic send to each different tracking platform ?


10-10-2012 10:45 PM #10 zeno (Administrator)

Quote Originally Posted by hd2010 View Post
@zeno : $token holds the value of unique subid that uniquely identify each click ?
Yo, yeah $token is just whatever subid you need to postback, e.g. sb_src or t202kw or whatever. I just made it generic. Thanks for mentioning switch case, duh is so much easier - can't believe I was using if elseif xD

The postback fires to just one tracking platform based on whatever $source value you pass. So in this case the script it for a situation where you are running traffic from multiple sources (all which have their own pixels) but can only set one postback with the network, so need something in the middle which diverts the traffic appropriately. If you wanted one conversion to fire to multiple platforms you could just rework it so that it did multiple postbacks in a row rather than choosing one. Here's an updated script using switch case:

[PHP]
<?
$source = $_GET['source']; //traffic source
$token = $_GET['token']; //tracking token

// postback based on traffic source in $source
switch($source)
{
// Facebook
case 'fb':
$r = new HttpRequest('http://trackingpixel1.com/index.php?something='.$token, HttpRequest::METH_GET);
break;
// PoF
case 'pof':
$r = new HttpRequest('http://trackingpixel2.com/index.php?something='.$token, HttpRequest::METH_GET);
break;
// Google
case 'goog':
$r = new HttpRequest('http://trackingpixel3.com/index.php?something='.$token, HttpRequest::METH_GET);
break;
default:
exit();
break;
}
// send request
try {
$r->send();
if ($r->getResponseCode() == 200) {
// do nothing, this means the conversion has been counted properly
}
} catch (HttpException $ex) {
// do nothing or log that the call failed
}
?>
[/PHP]


10-11-2012 12:29 AM #11 cole (Member)

You can also do it on the NB platform with 'sites'. If you go to the 'Account' tab, you can add as many sites to your account as you like. Add a site for each traffic source, and then once you are at the offer page go to the 'Advanced' tab -> 'Postback URL' and add site specific postbacks. Make sure that when you pull your affiliate link you choose the right site associated with that link (you can set this in the pulldown menu), and then use that link on your various traffic sources.


10-11-2012 05:35 PM #12 d4rk (Member)

@cole: My AM also told me that if you have both a global postback and a campaign-level postback, they will both fire in sequence upon a conversion. Correct?


10-11-2012 10:26 PM #13 cole (Member)

no, that's not quite right. campaign level postbacks supersede globals. holler @ me on skype if you want a hand setting anything up.


10-12-2012 07:11 PM #14 hd2010 (Member)

cole is right on that, but global pixel is very much convenient to use


11-24-2012 09:21 AM #15 joejoechen (Member)

did anyone use this, and got it working?


11-24-2012 09:28 AM #16 hd2010 (Member)

zeno himself, I'm not really tested it out


12-11-2012 03:35 PM #17 nitzanmatomy (Member)

Zeno - that was awesome
Thanks


Home > Paid Traffic Sources > Mobile