Similar to How To Setup Voluum Postback with OneSignal we show you here how to setup Binom postback with Pushnami.
function getURLParameter(name) { return decodeURI( (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1] || '' ); } function getAllUrlParams(url) { var queryString = url ? url.split('?')[1] : window.location.search.slice(1); var obj = {}; if (queryString) { queryString = queryString.split('#')[0]; var arr = queryString.split('&'); for (var i=0; i<arr.length; i++) { var a = arr[i].split('='); var paramNum = undefined; var paramName = a[0].replace(/\[\d*\]/, function(v) { paramNum = v.slice(1,-1); return ''; }); var paramValue = typeof(a[1])==='undefined' ? true : a[1]; paramName = paramName.toLowerCase(); if (obj[paramName]) { if (typeof obj[paramName] === 'string') { obj[paramName] = [obj[paramName]]; } if (typeof paramNum === 'undefined') { obj[paramName].push(paramValue); } else { obj[paramName][paramNum] = paramValue; } } else { obj[paramName] = paramValue; } } } return obj; } var browser = getAllUrlParams().browser_name.replace(/%20/g, " "); var browser_version = getAllUrlParams().browser_version.replace(/%20/g, " "); var os_name = getAllUrlParams().os.replace(/%20/g, " "); var os_version = getAllUrlParams().os_version.replace(/%20/g, " "); var device_name = getAllUrlParams().device.replace(/%20/g, " "); var device_brand = getAllUrlParams().brand.replace(/%20/g, " "); var device_model = getAllUrlParams().model.replace(/%20/g, " "); var isp = getAllUrlParams().isp.replace(/%20/g, " "); var country_code = getAllUrlParams().country_code.replace(/%20/g, " "); var traffic_source = getAllUrlParams().source.replace(/%20/g, " "); var clickid = getAllUrlParams().cid.replace(/%20/g, " "); (function(document, window){ var script = document.createElement("script"); script.type = "text/javascript"; script.src = "https://api.pushnami.com/scripts/v1/pushnami-adv/{PUSHNAMI_ID}"; script.onload = function() { Pushnami .update({ "browser": browser, "browser_version": browser_version, "os_name": os_name, "os_version": os_version, "isp": isp, "device_name": device_name, "device_brand": device_brand, "device_model": device_model, "country_code": country_code, "traffic_source": traffic_source, "clickid": clickid }) .prompt() }; document.getElementsByTagName("head")[0].appendChild(script); })(document, window);
Make sure to replace {PUSHNAMI_ID} with your own ID.
So this is an advanced setup of Pushnami. It contains code to tag your subscriber with details like: Browser, Browser Version, OS Name, Os Version, ISP, Device Name, Device Brand, Device Model, Country Code, Traffic Source and Clickid.
We want to collect these details so you can target them later when creating campaigns.
Create Landing Page in Binom with Tokens
To make the variables work you need to pass the tokens to your landing page like this:
[php]https://videopuzzy.com/play.html?source={trafficsource_name}&country_code={country_code}&device={device_name}&brand={device_brand}&model={device_model}&browser_name={browser_name}&browser_version={browser_version}&os={os_name}&os_version={os_version}&isp={isp}&cid={clickid}[/php]Create Variables in Pushnami
In order for Pushnami to track the data you need to create "variables". You can do that when you go to Settings->Variables->Account
After you add them it should look like this:
Binom Postback
If you are buying traffic to collect your subscribers you want to track conversions (when a user subscribes).
The way you can do that is using Pushnami Webhooks. Basically how it works is that Pushnami pings a URL of your choice using POST with the subscriber data in JSON format.
Here's an example of what they post:
[php] {"event":"onSubscribe","subscriber":{"isp":"TOT","browser":"Chrome","browser_version":"76","device_name":"Desktop","device_brand":"Desktop","device_model":"Desktop","os_name":"Mac OS X","os_version":"10.14","country_code":"TH","traffic_source":"Advertizer","clickid":"ab2067v108","subscriberId":"5d6ee2e710700026eba47c7c","subscriberGeo":{"dip":"113.x.x.45","dcity":"Ban Bang Phli Nakhon","dstate":"11","dcountry":"TH","dtimezone":"Asia/Bangkok","dzip":"10540"}},"campaign":{"campaignId":""}} [/php]What we're looking for is the custom variable "clickid" that we need to send the postback to Binom.
So we create a little script with the following PHP code:
[php] $rawData = file_get_contents("php://input"); $vars = json_decode($rawData); file_put_contents('output.txt', $rawData); file_get_contents('http://binom.affiliateweapons.com/bounce.php?cnv_id=' . $vars-&gt;subscriber-&gt;clickid); [/php]Off course change the domain "binom.affiliateweapons.com" to your own.
Upload the script to your webserver and enter the URL in Pushnami:
Go to Settings->Webhooks->Configure Webhooks->WebPush
Important Note: You need Pushnami Premium to enable Webhooks. You can ask your account manager to activate this.
Summary
- Register for a Pushnami Trial account
- Ask the account manager to enable Premium
- Upload the landing page to your webserver
- Create landing page with tokens in Binom
- Upload the webhook script to your webserver
- Add the variables in Pushnami
- Enter the webhook URL in Pushnami
- Start sending traffic and collect subscribers
If you need help with setting this up in a different tracker than Binom, let us know and we'll be glad to help you.