Be a Supporter!

Browse Sections


Newgrounds Wiki: Revenue Sharing Pools

Newgrounds takes great pride in offering our users revenue sharing opportunities. We do this by working with our advertising partners to track earnings on a per-project basis.

Tracking IDs

In order to best track how our users earn their revenue, we generate tracking ids for each submission. These IDs are usually the ID of the submission, suffixed by a 2-digit code representing the type of ad.

We can include these IDs in any ad embed code our partners provide so they can track earning statistics on their systems.

Revenue Statistics

In addition to sharing revenue with our users, we also provide them with earnings statistics. We do this during the following timeframes: Every Hour - Statistics for the current date are pulled and updated. Once Per Day - Final Statistics for the previous day are pulled and updated. The First of a New Month - Final Statistics for the previous month are pulled and updated. Statistics for the NET30 month (2 months before current) are also pulled and updated to allow for any audits that may have occurred.

These statistics should be available to our servers to download using a unique token or login to identify our publisher account, and parameters for requesting any of the above periods.

Feeds should contain the following statistics for each tracking id on a single line:
  • tracking_id - The tracking id as passed in the ad embed.
  • impressions - The number of ad impressions generated by this id.
  • earnings - The total earnings for this tracked id.
Feeds should be in an easily parse-able format such as CSV, JSON or XML (JSON is ideal). Variable names can vary as needed.

Because these feeds can be quite large and database intensive, any advertisers have taken to caching them in advance to prevent request timeouts.

Examples

Sample Ad Embed

Below is an example of how we might render an ad embed code with php + javascript:
<script type="text/javascript" 
src="http://www.youragency.com/getunit.aspx?unit_id=123456&tracking_id=<?
echo $submission->getID() . $adtype->getID();
?>"></script>
In this example, the 'unit_id' parameter in the request string would be an id provided by the advertiser indicating this is a specific ad for the newgrounds account. The 'tracking_id' would be the tracking id used for filtering the earnings for the current submission.

Sample Stats Request

Below is a sample of how we may load your stats feed via PHP:
# Server & Authentication values
$host = 'www.youragency.com';
$path = '/earningsreport.aspx';
$port = 80;
$publisher_id = 12345;
$secret_token = "JKdhfkl9843hkjnsdf9knc9843h93cno39";

# Date range $start_date = date("Y-m-01", strtotime('-1 month')); // first day of last month $end_date = date("Y-m-t", strtotime('-1 month')); // last day of last month

# build the request query $query = "pubisher_id=$publisher_id"; $query .= "&secret_token=$secret_token"; $query .= "&start_date=$start_date": $query .= "&end_date=$end_date":

# construct the POST header $post="POST $path HTTP/1.1 Host: $host Content-type: application/x-www-form-urlencoded User-Agent: Mozilla 4.0 Content-length: ".strlen($query)." Connection: close $query";

# connect to the host $socket=fsockopen($host,$port, $errNo, $errString, 20000);

if (!$socket) throw new Exception("Connection failed: $errString ($errNo)"); # send the POST request

fwrite($socket,$post);

// read and parse results here

Sample Feed Result

{tracking_id:526374801, impressions:6590, earnings:3.78}
{tracking_id:524729101, impressions:12348, earnings:7.46}
{tracking_id:468291101, impressions:235, earnings:0.08}
{tracking_id:429453201, impressions:3262, earnings:2.01}
..etc..