Parameters are special custom fields that can be added to offers, their goals and nested products. They allow you to store variables that change from offer to offer. For example, identifiers of an offer or stream on the side of the target network.
Setting parameters in the offer
Parameters are managed in the "Offers" section by clicking the "Parameters" button. The name of the parameter is set on the left side of the table. It can consist of small Latin letters, numbers and a hyphen symbol. In the right part of the table, the value of the parameter is set in an arbitrary form.
Using parameters in fields
To insert a parameter value into a field or URL string, use the macro:
{ofp:xxx}
Where you shoud put the name of the parameter instead of xxx
.
Sometimes in the offer it is required to set a parameter that changes depending on the country of the lead's arrival. For example, the target network receives traffic from different countries on different flow IDs. Such parameters are called geo-specific. To set them, a macro is used:
{ofpg:xxx}
Where you shoud put the name of the parameter instead of xxx
.
At the same time, several parameters are set in the offer at once. One of them must have the same name as the one specified in the macro. It is used by default for all geos. Other parameters should be named in the format xxx-zz
, where xxx
is the name of the base parameter, zz
is the ISO country code in small letters. For example:
crmuid Main offer ID crmuid-de Offer ID for Germany crmuid-fr Offer ID for France
Parametric fields are set like this:
offer_id {ofp:crmuid} flow_id {ofpg:crmflow}
Using parameters in code
You can directly work with fields from preprocessing and processing code. The main parameters are stored in the array $ofps
and can be obtained like this:
$foo = $ofps['crmuid'];
Here and below crmuid
is an example of a parameter name.
An alternative method for obtaining a parameter is a request to the system API. The first option is used when sending leads, the second - when checking the status of leads.
$core->cpa->get( 'ofp', $o['offer_id'], 'crmuid' ); $core->cpa->get( 'ofp', $off, 'crmuid' );
Geo-specific parameters are only available when submitting leads. They are stored in the variable $ofpg
and can be obtained like this:
$bar = $ofpg['crmuid'];
Nested product parameters
When creating product integrations, you may need to access nested product parameters. They are convenient for storing product SKUs in the target CRM or delivery service.
Getting an array of parameters xxx
as a product-value:
$itp = $core->cpa->get( 'vpar', $o['offer_id'], 'xxx' );
Getting an array of all parameters in the form of a product-array:
$itp = $core->cpa->get( 'vpars', $o['offer_id'] );
There is a hack to simulate geo-specific product parameters. At the beginning of the preprocessing code, we get the parameters like this:
$itp = $core->cpa->get( 'vpar', $o['offer_id'], 'xxx' ); $itg = $core->cpa->get( 'vpar', $o['offer_id'], 'xxx-'.$o['order_country'] );
When using the parameter by product ID $it
we use the following code:
$foo = isset( $itg[$it] ) ? $itg[$it] : $itp[$it];
Goal parameters
When working with goals, you can use the parameters associated with them. They can store identifiers of target actions on the side of the receiving CRM. To insert a parameter value into a field or query string, use the macro:
{goal:xxx}
Where you shoud put the name of the parameter instead of xxx
.
You can directly work with fields from preprocessing code and processing code. The main parameters are stored in the array $gpar
and can be obtained like this:
$foo = $gpar['crmuid'];
An alternative method for obtaining a parameter is a request to the system API.
$core->goal->param( $o['offer_id'], $o['goal_id'], 'crmuid' );
Site parameters
You can add parameters to offer sites. They can store symbolic site identifiers on the advertiser's side. If the lead does not have a site specified, the default site is used. To insert a parameter value into a field or query string, use the macro:
{site:xxx}
Where you shoud put the name of the parameter instead of xxx
. Site parameters are geo-dependent and support the same workflow as the ofpg
of the offer.
You can directly work with fields from preprocessing code and processing code. The main parameters are stored in the array $spar
and can be obtained like this:
$foo = $spar['landing-group'];