Skip to main content

NAVIGA-AD Internet Orders Actual GL Split

Type: Campaigns

Returns GL Revenue allocation values by Sub Orders

NAVIGA-AD Internet Orders Actual GL Split Downloads

Returns GL Revenue allocation values by Sub Orders

Bundle (TGZ): NAVIGA-AD Internet Orders Actual GL Split
Definition JSON: naviga-ad-internet-orders-actual-gl-split.json

Summary​

This report reads from new fields (2026) in AD Internet Orders mapping.

  • GL Rev Amt - The revenue amounts for each GL Code in the GL Codes field.
  • GL Rev Codes - The GL Codes to be applied to the revenue Amounts
  • GL Rev Source - The rules that the GL Split using
  • GL Comm Amt - The commission amounts for each GL Code in the GL Comm Codes field.
  • GL Comm Codes - The GL Codes to be applied to the commission Amounts
  • GL Comm Source - The rules that the GL Comm Split using

Below is an image of where you will see the Revenue G/L Allocations in a Campaign.

Pasted image 20260821094339.png

The Informer fields mentioned above will have the values from the "Revenue G/L Allocations" tab, however, this tab aggregates all sub orders that are on a line.

For example if a line ran for 3 months, hence 3 sub orders, each of $100. The Allocation would show 300 split across the GLs.

This report will take the aggregated GL Allocation and apply it to each sub order.

Let's walk through a scenario.

Scenario Details​

Context:

  • Campaign ID: 22572
  • Line ID: 70176
  • Sub Orders: Multiple sub-orders each with an actAmount of $200, combining to reach a total campaign amount of $5,200 (26 sub-orders total).

Revenue Distribution:

  • GL Codes: ['001', '002'] (made these up to keep it simple)
  • GL Amounts: [2600, 2600] (Total: $5,200)

Commission Distribution:

  • GL Comm Codes: ['400', '500'] (made these up to keep it simple)
  • GL Comm Amounts: [-1300, -1300] (Total: -$2,600)

Mathematical Breakdown for a Single Sub-Order​

For a single sub-order where actAmount = 200:

1. Revenue Spread​

  1. Total GL Amount: 2600 + 2600 = 5200
  2. Allocation: Each GL code represents 2600 / 5200 = 50% of the total.
  3. Result: The $200 is split 50/50.
    • GL 001: $100
    • GL 002: $100

2. Commission Spread​

  1. Total Commission Amount: -1300 + -1300 = -2600
  2. Commission Percentage: -2600 / 5200 = -50%
  3. Commission for this actAmount: 200 * -50% = -100
  4. Allocation: Each commission GL code represents -1300 / -2600 = 50% of the commission pool.
  5. Result: The -$100 commission is split 50/50.
    • GL 400: -$50
    • GL 500: -$50

Informer Use​

In Informer, we will call these functions (see below implementation) and will be return an array of sub order GL Amounts/GL Codes and GL Comm Amount/GL Comm Codes proportionally split from the aggregation GL Amount fields.

NOTE: The GL Amounts for each sub order will be GROSS, i.e. inclusive of the GL Commission amount

These arrays will need to then be normalized.

JavaScript Implementation​

Below are the two functions required to process this logic. Both functions include "penny rounding protection" on the final array element to ensure no fractional cents are lost or gained during complex splits. All this means is that as we loop through and split the revenue across the GLs we are subtracting each interaction value from the total amount. Then on the last item in the array, instead of calculating (actAmt*proportion), we just return what is left from the total amount that we started with.

/**
* Spreads a single actAmount proportionally across Revenue GL codes.
*/
function spreadProportionally(actAmt, glRevAmounts, glCodes) {
const totalGlAmount = glRevAmounts.reduce((sum, amt) => sum + amt, 0);
if (totalGlAmount === 0) throw new Error("Total GL amount cannot be zero.");

let remainingActAmt = actAmt;
const glSpreadAmts = [];

glRevAmounts.forEach((glAmt, index) => {
if (index === glRevAmounts.length - 1) {
glSpreadAmts.push(Number(remainingActAmt.toFixed(2)));
} else {
const proportion = glAmt / totalGlAmount;
const allocatedAmt = Number((actAmt * proportion).toFixed(2));
glSpreadAmts.push(allocatedAmt);
remainingActAmt -= allocatedAmt;
}
});

return { glCodes, glSpreadAmts };
}

/**
* Calculates the commission amount from an actAmount and spreads it across Commission GL codes.
*/
function spreadCommission(actAmt, glAmounts, glCommAmounts, glCommCodes) {
const totalGlAmount = glAmounts.reduce((sum, amt) => sum + amt, 0);
const totalGlCommAmount = glCommAmounts.reduce((sum, amt) => sum + amt, 0);

if (totalGlAmount === 0) throw new Error("Total GL amount cannot be zero.");

const commPercentage = totalGlCommAmount / totalGlAmount;
const actCommAmt = Number((actAmt * commPercentage).toFixed(2));

const glCommSpreadAmts = [];

if (totalGlCommAmount === 0 || actCommAmt === 0) {
return { glCommCodes, glCommSpreadAmts: glCommCodes.map(() => 0) };
}

let remainingCommAmt = actCommAmt;

glCommAmounts.forEach((commAmt, index) => {
if (index === glCommAmounts.length - 1) {
glCommSpreadAmts.push(Number(remainingCommAmt.toFixed(2)));
} else {
const proportion = commAmt / totalGlCommAmount;
const allocatedAmt = Number((actCommAmt * proportion).toFixed(2));
glCommSpreadAmts.push(allocatedAmt);
remainingCommAmt -= allocatedAmt;
}
});

return { glCommCodes, glCommSpreadAmts };
}

Description​

GL Revenue based report that uses the GL Rev Amount, GL Rev Codes and other fields to show the actual GL breakouts based on your Naviga setup (https://dev.navigahub.com/EW/devdigital/ad/setup/digital_setup)

Fields​

LabelAliasTypeHiddenDescription
Campaign IDcampaignIddoubleCampaign Identifier
Line IDidkeyword_textLine Identifier
Month Start DatemonthStartDatedateMonth start date is the starting date for the sub order on a line. Lines can have one or more sub orders. For print ads, this is synonymous with Issue Date.
Product IDwebSiteIdkeyword_textProduct Id
Productweb_site_id_assoc_webPubNamekeyword_textProduct Name/description
Proportion Gl AmountsproportionGLAmountsdoubleSub Order GL Gross Amount.
Proportion Gl CodesproportionGLCodeskeyword_textSub order GL Code
Proportion Gl Comm CodesproportionGLCommCodeskeyword_textSub Order Agency Commission GL Codes
Proportion Gl Comm AmountsproportionGLCommAmountsdoubleSub Order Agency Commission GL Amounts
Proportional SpreadproportionalSpreadobject(hidden) Used in calculating final GL Rev Amt values
Proportion Gl SourceproportionGLSourcekeyword_textGL Rev Source rule
Proportion Gl Comm SourceproportionGLCommSourcekeyword_textGL Comm Source rule
Gross Line Local RevenuegrossLineLocalRevenuedouble(hidden) calculated Gross line local revenue used in calculating the proper split of the GL Rev Amt and the GL Comm Amt for each sub order
Proportional Comm SpreadproportionalCommSpreadobject(hidden) Used in calculating final GL Comm Amt values
GL Line IDglLineIdkeyword_textAdded for testing/debugging, same as Line ID, but different granularity
GL Comm AmtglCommAmtdouble(hidden) This is a MV/SV field that contains the breakouts of the total agency commission Line amount across the defined GLs.
GL Comm CodesglCommCodeskeyword_text(hidden) This is a MV/SV field that aligns with the GL Comm Amt to show the GL Code associated with the agency commission amount
GL Rev CodesglRevCodeskeyword_text(hidden) This is a MV/SV field that aligns with the GL RevAmt to show the GL Code associated with the gross amount
GL Rev AmtglRevAmtdouble(hidden) This is a MV/SV field that contains the breakouts of the total gross Line amount across the defined GLs.
Month Actual AmtmonthActualAmtdouble(hidden) used in calculating the proper split of the GL Rev Amt and the GL Comm Amt for each sub order
Month Est AmtmonthEstAmtdouble(hidden) used in calculating the proper split of the GL Rev Amt and the GL Comm Amt for each sub order
AD Internet Campaigns Internet Campaign Typea_d_internet_campaigns_assoc_campaignTypekeyword_textType of campaign
M = Performance
F = Flexible
GL Comm SourceglCommSourcekeyword_text(hidden) The rules that the GL Comm Split is using
GL Rev SourceglRevSourcekeyword_text(hidden) The rules that the GL Split is using