Documentation

Getting Started

What is RubiQube VideoPay™?

RubiQube VideoPay is a reward – based video advertising platform that drives engagement and monetization opportunities for online publishers, while delivering rewards to their end users and providing advertisers with engaged customers.

We provide an additional button for online users to pay by watching a 15 second video clip.

To integrate the RubiQube Reward Ads button to your service, you need to follow the steps below:

  • Create an Account and select Publisher option using your correct user details on http://track.therubiqube.com/signup.php
  • Login with created credentials on http://track.therubiqube.com/login.php
  • Upon success of Login, move on to CREATE APP – Creating App where you intend to place this Ad button.
  • After that, you CREATE A PLACEMENT – with Information of the exact point where you want this Ad button deployed on the App. Information such as Placement Name, Message to be written on the button, nature/genre of Ads to be shown and Callback URL to redirect users to upon receiving rewards.

Benefits

  • Encourages streaming services or content users to stay active longer than they might have otherwise.
  • Incentivized Video Ads can be used to nudge non-paying users towards In-App-Purchases (IAPs).
  • Incentivized-view only, leading to informed clicks and high quality downloads.
  • Additional revenue from non paying users.

Web Snippet API

After you might have created the PLACEMENT it redirects you to a page where you click “GENERATE CODE” button. A modal popup would appear with a code snippet.

Copy the snippet generated for you on the system and paste at whatever point on the website you want the Ad Button to appear at. You can paste in a DIV or a TABLE layout with a custom design layout.

Generated Sample Snippet JS Code

<script>
		var publisherID = '100000'; //Auto Insert your PUBLISHER ID here from publisher form.
		var placementID = '1005'; //Auto Insert your AD PLACEMENT ID here from publisher form.
		var callbackURL = 'http://www.therubiqube.com/sample_callback.php'; //Auto Insert your CALLBACK URL here from publisher form.
		var message = 'Watch Ads to Earn'; //Auto Insert the MESSAGE on your button here from form.
		var topcolorShade = '#2D2F2F'; // Auto insert the color shade for top part of button.
		var bottomcolorShade = '#161719'; // Auto insert the color shade for bottom part of button.
		document.write('<script src=\'http:\/\/store.therubiqube.com\/js\/reward.js\'><\/script>');
</script>

Once this is pasted, a button like the below appears

When this button is clicked, a modal popup appears and within it, shows the video Ad to play. See below image.

After Video Ad must have been watched, some unique data will be automatically parsed to the Callback URL provided. To receive these data from our servers, a sample code base for a callback URL is written in PHP for better understanding on how to receive data.

Sample Callback PHP Code

<?php
		$publisherID = $_GET['publisherID'];
		$placementID = $_GET['placementID'];
		$earnings = $_GET['earnings'];
		$adName = $_GET['adName'];
		$only_country = $_GET['only_country'];
		$userID; //Get the ID of user currently signed in.
		$reward_given; //Set reward to be issued to user. E.g Song Download, Free access to album. This can be linked to the existing access/download system
		//Check for convergence; if publisher and placement ID received from RubiQube is equal to the ID assigned to you.
		if ($publisherID == '1000005' || placementID ='1005'){
		//Do all things regarding rewards management. E.g below.
		//Connect to DB.
		$host="localhost"; // Host name.
		$db_user="root";
		$db_password="password";
		$db='spinlet_db'; // Database name.
		$conn=mysql_connect($host,$db_user,$db_password) or die (mysql_error());
		mysql_select_db($db) or die (mysql_error());
		//Insert into spinlet_reward table to register reward for unique users.
		$insert = "INSERT INTO spinlet_reward (userID,earnings,adName,country,reward_given) VALUES ('$userID','$earnings','$adName','$only_country', '$reward_given')";
		$insertresult = mysql_query($insert, $link) or die(mysql_error());
		}
		echo "Reward has been issued to user as free music download";
?> 
NOTE: This is just a sample code base written in php for how a typical callback page should look like. Replace with proper codes that issues users rewards (like music downloads or free access to songs) when those data are received by your server.

The table below also itemizes all the data being sent and to be received and manipulated to issue rewards.

Sample REST API

http://store.therubiqube.com/VideoAlgo/algoApi.php?publisherID=1000005&placementID=1005&callbackURL=http://www.therubiqube.com/sample_callback.php
	  

Sample Request Data

publisherID=1000005&placementID=1005&callbackURL=http://www.therubiqube.com/sample_callback.php
	  

publisherID: publisherID is a unique ID assigned to a publisher. It is gotten after creating a placement and during code generation.

placementID: placementID is a unique ID for each placement created and also assigned to the button after creating a placement and during code generation.

callbackURL: callbackURL is the link where all reward management will be processed. It is filled in when creating a placement on the system.

Sample Response Data

	{
		"id":"9",
		"bid":"120",
		"adUrl":"uploads\/",
		"ad_upload_video":"http:\/\/track.therubiqube.com\/advertiser\/uploads\/motorola.mp4",
		"placementID":"1005",
		"publisherID":"1000005",
		"earnings":64.8,
		"adName":"New Add is created ",
		"ip":"105.112.34.222",
		"browser":"Mozilla\/5.0 (Windows NT 6.1; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/49.0.2623.87 Safari\/537.36",
		"callbackURL":"http:\/\/www.therubiqube.com\/sample_callback.php",
		"only_country":"Nigeria",
		"updateDBURL":"http:\/\/store.therubiqube.com\/VideoAlgo\/updateDBApi.php?id=9&bid=120&adUrl=uploads\/&ad_upload_video=http:\/\/track.therubiqube.com\/advertiser\/uploads\/motorola.mp4&placementID=1005&publisherID=1000005&earnings=64.8&adName=New Add is created &ip=105.112.34.222&browser=Mozilla\/5.0 (Windows NT 6.1; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/49.0.2623.87 Safari\/537.36&callbackURL=http:\/\/www.therubiqube.com\/sample_callback.php&only_country=Nigeria"
	}
	  

* ad_upload_video *: Very important variable. This is where you get the Link to the Video Ad itself

*updateDBURL*: This is the URL where a GET request is sent to update the Database on each video Ad impression. Below is the sample request data to be sent for a GET request.

$id

$bid

$ip

$adUrl

$publisherID

$placementID

$earnings

$adName

$browser

$callbackUrl

$only_country

Include rubiqube sdk in your gradle dependency

Download and copy rubiqubesdk.aar file into your project's libs folder

Download SDK here

Download Sample MainActivity.java code

  dependencies {
	compile (name: 'rubiqubesdk', ext:'aar')
	compile 'com.android.support:appcompat-v7:23.3.0' //IMPORTANT: Rubiqube sdk depends on this library to work
	compile 'com.loopj.android:android-async-http:1.4.9'    //IMPORTANT: Rubiqube sdk depends on this library to work
	}

Initialize rubiqube sdk

import rubiqube.ng.rubiqubesdk.*;
	Ad rubiqube = Ad.getInstance();
	rubiqube.init(publisherID, placementID, callback_url);
Params

(INT) publisherID (INT) placementID (STRING) callback_url

Get your publisher and placement IDs from RubiQube website, the callback url will be used to update your database.

Listen to RubiQube internal events

	  rubiqube.setOnAdListener( new Ad.OnAdListener(){
            @Override
            public void onFinished(){
                Toast.makeText(getApplicationContext(), "YOU HAVE BEEN REWARDED 10G Points", Toast.LENGTH_LONG).show();
                Log.v("MAIN ACTIVITY", "VIDEO AD FINISHED");
            }

            @Override
            public void onInitError(){

                Toast.makeText(getApplicationContext(), "ADVERT VIDEO COULD NOT BE INITIALIZED", Toast.LENGTH_LONG).show();
                Log.v("MAIN ACTIVITY", "VIDEO COULD NOT BE INITIALIZED");
            }

            @Override
            public void onInitSuccess(){
                //This is the right time to play the video Ad 
                Toast.makeText(getApplicationContext(), "VIDEO IS INITIALIZED", Toast.LENGTH_LONG).show();
                Log.v("MAIN ACTIVITY", "VIDEO IS INITIALIZED");
            }

        });
		

Play video Ad

    rubiqube.showVideo(_activity); //_activity is the current activity from which you wish to launch the video Ad