Leads distribution management

Distribution of orders by companies is carried out in two stages: upon receipt of the order in the system and upon confirmation of the order in the call center. When working with a company such as "Call center" confirmed order must be transferred further, because the call center can only work with orders at the stage of calling

Order distribution is set up in the General settings of the offer. Two (or three) parameters are responsible for it:

  • Default company - the order is transferred to it if it was not possible to choose alternatives according to the specified parameters. Ideal for cases when the offer is fully serviced by one company. In this case, you do not need to specify any other distribution parameters
  • List of companies for the call center - allows you to specify a list of companies where the call center can transfer orders depending on the results of the conversation with the client. Adds a company selection field from the list of specified IDs to the call center employee. This will allow, for example, to send doubtful customers to third-party companies, and for your company to select only the highest quality orders. The item is only available for the call center.
  • Order distribution script - an algorithm for automatic distribution of orders in accordance with the specified conditions. For example, distribute orders to companies depending on GEO, separate some of the traffic from the company to another company, transfer orders of VIP-users to your own call center, and so on.

If none of the three options has not been transferred to the order, it is transferred to the company from the site where the order came. It is recommended that you always set the default company.

Order distribution script

The script is an algorithm that describes the conditions of sequential order processing. Script lines are processed in turn from top to bottom. If the conditions on the line match the order, it goes to the specified company and script processing stops.

Script lines are specified in the following format:

parameter:value probability% time(from-to) #company

Example of order distribution script:

city:[london] #5
area:[?california] #10
geo:ru 50% #10
geo:ru #5
geo:kz user:3 #5
80% #8
geo:ua time(8-16) #2
geo:ua time(130-730) #17

Each line of the script must contain the identifier of the company where the order will be distributed. The identifier is specified with the lattice symbol in front of it, without a space after it.

Basic parameters

To distribute orders, you have the following options:

  • user:XX - the user on whom the order came
  • gang:XX - the arbitrator team which made the lead
  • comp:XX - the company on whom behalf the order came
  • flow:XX - the traffic flow on whom behalf the order came
  • site:XX - the landing page on which the order was made
  • space:XX - the pre-landing page, from which the visitor made the order
  • ext:XX - the Agency from which the order was received
  • exts:XX - the publisher from whom the order was received
  • geo:ZZ - the country that is specified in the order or marked by the call center
  • geoip:ZZ - country that was determined by the customer's IP address
  • city:[YYYY] - the city to which the delivery is made (specified by the call center or determined by IP)
  • area:[YYYY] - the area (region) to which the delivery is made (specified by the call center or determined by IP)
  • mobile:XX - mobile traffic sign, 0 or 1
  • bad:XX - sign of bad traffic, 0 or 1
  • reason:XX - cancel reason code (for cancel processing script)
  • utms:[YYYY] - UTM-tag utm_source
  • utmc:[YYYY] - UTM-tag utm_campaign
  • utmn:[YYYY] - UTM-tag utm_content
  • utmt:[YYYY] - UTM-tag utm_term
  • utmm:[YYYY] - UTM-tag utm_medium

In the list above:

  • ХХ - integer identifier of an object
  • YYYY - the name of the settlement or region is indicated in square brackets. If it is necessary to set strict correspondence, for example strictly "Moscow" - it is specified [Moscow]. not case sensitive. If you need to specify a non-strict match and search for a word in the line, the question mark is indicated before the word: [?chechnya] This will correspond to the "Republic of Chechnya", "Rep. Chechnya", "Chechnya, Republic", and any other variant where a set of "Chechnya" characters occurs, regardless of case. Sign "?" must be placed immediately after the opening parenthesis. It applies to all further characters in the brackets.
  • ZZ - ISO-country code, indicated in Latin small letters

You can use several parameters in one line. In this case, the string will only fire if all conditions are met at the same time. To get the triggering of at least one of the conditions, just make two lines, for example:

area:[?chechnya] #10
area:[?dagestan] #10

Or list the conditions separated by commas. This option is suitable for integer identifiers and ISO country codes. For example:

geo:us,ca,mx #5
gang:2,4,5 #6

Dividing traffic

You can set the probability of a line being triggered. The probability can be set together with or without other conditions. It is specified as an integer between 1 and 100 percent with a percent sign. Note that you specify the probability of triggering, not the percentage of traffic distribution. This means that to distribute traffic equally between two companies, you must set the probability to 50% and the probability to 100% (or not at all if there are no other conditions).

For example, the distribution of orders by GEO equally into two companies:

geo:ru 50% #1
geo:ru #2

An example of the distribution equally into three companies:

geo:ru 33% #1
geo:ru 50% #2
geo:ru #3

Important! To understand why this is done - study probability theory. The course of higher mathematics is not included in this manual.

Limiting leads count

You can limit incoming leads count by setting maximum number of leads in certain status for certain period. In general, limiting block looks like this:

max(period,type,count)

Parameter period sets the time period to count leads, possible values:

  • day - current day in system time, from midnight
  • 24h - last 24 hours
  • week - last 7 days
  • month - last 30 days
  • year - last 365 days
  • any - no time limit

Parameter type sets the lead status to check, possible values:

  • any - leads in aly status
  • valid - valid leads (all except trash and deleted)
  • wait - waiting leads (including hold)
  • accept - approved leads
  • ok - all leads except cancelled (accepted and waiting)

Parameter count - maximum number of leads to transver in company.

For example, max(day,any,100) will transver not more than 100 leads each day, max(24h,valid,30) will transfer 30 valid leads maximum per 24 hours.

Please note, the max parameter must be set exactly as shown in this manual: no spaces, parameters match listed above, number of leads above zero. Otherwise it will be ignored.

Time and day-of-week based distribution

You can distribute orders based on when they arrive. The time is specified in the special parameter time(from-to). The values from and to can be either 0 to 24 hours or the exact time from 0000 to 2359. The time is specified together, without a period or colon between the hours and minutes. In the parameters you can use both hours and hours with minutes - as it will be more convenient. The time distribution is specified only together with other conditions or probability. Without conditions or probabilities, it won't work.

In addition, you can distribute orders based on the day of the week they are received. The day of the week is specified in the special parameter dow(from-to) or dow(day), for example dow(1-5) or dow(7). The parameters are ordinal days of the week, where 1 is Monday and 7 is Sunday. The daily distribution is specified only together with other conditions or probability. Without conditions or probabilities, it won't work.

Special parameters

You can check whether copmany is active or not. It's useful when you work with different suppliers and doesn't let you supplier dive into low balance. To make script working only with acive company, add the magic word @active to the line and script will check the company balance and it's blocking limit.

Traffic distribution rotators

Sometimes it is necessary to use identical distribution rules for multiple offers. In this situation, traffic rotators come in handy - distribution scripts that are configured once and simply inserted into the offer. Work with rotators is performed in the "Control - Settings - Datasets - Traffic distribution rotators" section.

Add a rotator, specify a name convenient for you. In the "Value" field, enter the traffic distribution script. Save. Pay attention to the first column of the table - it indicates the identifier of the rotator that you need to insert. Use the rotator instead of the company ID with the rot(XXX) parameter, where XXX will be the rotator ID, for example: rot(13).

Features of the rotator:

  • The rotator is used instead of the company ID. If a rotator is set, the company ID is ignored.
  • You can only use one rotator per script line.
  • You can use a link to a rotator inside a rotator. The maximum nesting depth is 10 levels.
  • You can use a rotator in a line with any filtering parameters, caps, time and probabilities.
  • You can use a rotator inline without additional filtering options and probabilities.
  • Your distribution script can consist of one link to the rotator, don't forget to specify the default company in the offer.

Examples of using a rotator:

geo:ru rot(11)
time(9-21) rot(12)
rot(13)

"Bucket"

The "Bucket" algorithm is a special method of using rotators that allows you to choose not the first, but a random company from the list. It uses the same traffic rotators as described in the previous section, but changes their behavior. To call a rotator with the "Bucket" algorithm, instead of rot(XXX) use bucket(XXX), where XXX is the identifier of the rotator, for example: bucket(13).

Features of the "Bucket" algorithm:

  • Instead of selecting the first company from the script, the algorithm remembers all the companies that could potentially be available in the script and selects one of them randomly. All lines of the script are checked, the availability of all caps is analyzed.
  • When specifying a probability, no tricky algorithms are required. If some line has 10% of traffic, it will be exactly 10% of traffic. No tricks.
  • If some of the companies do not have a probability, it is distributed evenly among them.
  • If a certain company occurs in the script several times with a probability, the probability of its operation is summed up.
  • If all available companies have a combined probability less than 100%, the probabilities are adjusted automatically.

From a programmer's point of view

In general, the order distribution script is something like this:

if ( $geo == 'ua' ) return 3;
if ( $geo == 'ru' ) if ( rand( 0, 100 ) < 50 ) return 5;
if ( $geo == 'ru' && $user == 123 ) return 7;

Order distribution script examples

Example 1. We will distribute traffic from Ukraine to company 1, traffic from Kazakhstan-to company 2, the rest of the traffic-to company 3.

To do this, set company 3 as the default company, and use the distribution script as follows:

geo:ua #1
geo:kz #2

Example 2. Let's complicate the previous example and divide the remaining traffic equally between companies 3 and 4.

Again, we set company 3 as the default company and use this distribution script:

geo:ua #1
geo:kz #2
50% #4

Example 3. Give the Russian traffic, from our beloved publisher with the ID of 123 in the processing of good company 7.

In the distribution script, enter the line:

user:123 geo:ru #7

Example 4.

Company 1 gives better payouts on the offer, but does not accept traffic from Chechnya and Dagestan. Company 2 accepts any traffic. You want to distribute to the company 2 all orders from Dagestan and Chechnya, and redirect the rest of the traffic to the company 1.

As the default company, specify 1, add to the distribution script:

area:[?Chechnya] #2
area:[?Dagestan] #2

Example 5. Our general call center 1 is open from 8 to 18 hours, the spare call center 2 is open around the clock, but is more expensive. You want to distribute orders received from 8 hours to 17:30 in the first call center, and the rest - in the second.

In the script, specify a 100 percent probability of operation and conditions:

100% time(8-1730) #1
100% time(1730-8) #2

Example 6. Similar conditions, but traffic only in Russia.

In the script, do not specify the probability, since there is a condition of the traffic source

geo:ru time(8-1730) #1
geo:ru time(1730-8) #2

Example 7. Our favorite publisher 123 wants half of his Russian orders from 8:30 to 13:30 transferred to the call center 13, because at this time there is his favorite operator Mary.

In the script, specify all the required conditions

geo:ru user:123 time(830-1330) 50% #13