Advertising in the Smarty platform currently consists of pre-roll interactives for TV channels, which conceptually can be of 2 types:
- the operator’s internal advertising;
- from an advertising provider (integration with such is required).
Advertising entities
Commercial — a video file that will be played as a pre-roll in the operator’s service.
The form for creating a commercial
Advertising unit — a set of configuration parameters for displaying commercials.
The form for creating an advertising unit
Advertising provider — an external system for providing commercials that independently determines the queue and frequency of showing videos for certain channels.
How to set up advertising
You can enable advertising using the option: TVMIDDLEWARE_ADS_ENABLED. You can also additionally configure the time interval of the frequency of displaying an advertising unit using the ADS_BLOCK_FREQUENCY_INTERVAL option (the “Display settings” tab, the “Maximum unit display frequency for an account” field). The value is specified in seconds and by default is 3600 (1 hour).
Options are enabled in the Smarty configuration file (default path is /etc/microimpuls/smarty/smarty.py, more details about the options you can find in the “Configuration and maintenance of Smarty” — “System parameters” section). After this, you need to restart Smarty with the service uwsgi restart command.
Storage of commercials viewing history
Starting from Smarty version 1.94, the number of views of advertising units is stored in the redis cache (previously this information was stored in MongoDB). Due to this change, it became possible to clear the viewing history of commercials using the service command:
smarty_manage flushall
To avoid unintentional clearing of this information, it is recommended to add a protected cache configuration — if the configuration file does not contain the CACHES array, then this item can be skipped, otherwise it is worth checking whether the configuration parameters for the «protected» parameter are written in it. It is configured by analogy with «default» (the address must be different), for example:
CACHES = {
«default»: {
«BACKEND»: «core.cache.backends.RedisCache»,
«LOCATION»: «redis://127.0.0.1:6379/1»,
«OPTIONS»: {
‘PICKLE_VERSION’: 2
}
},
«protected»: {
«BACKEND»: «core.cache.backends.RedisCache»,
«LOCATION»: «redis://127.0.0.1:6379/2»,
«OPTIONS»: {
‘PICKLE_VERSION’: 2
}
},
}
Viewing records will be saved primarily in the protected part of the cache, in order to avoid accidental deletion.
Internal advertising
1. Create commercials to be shown to customers.
2. Create an advertising unit and configure the following parameters for it:
- days of the week and time of day on which commercials should be shown;
- number of advertising unit showings a day per customer;
- mark the channels for which pre-rolls should be played;
- mark the tariff packages that must be activated for a customer in order for the commercials to be displayed to them;
- tariff packages, the presence of which for a customer excludes the display of ads for them;
- select the type of Smarty advertising provider and mark the commercials included in this advertising unit.
Advertising from external AdStream provider
1. Create an advertising provider object using the External Ad Provider object in the service administration panel (the key is requested from the external provider):
Advertising provider creation form
2. Create an advertising unit using the same principle as for internal advertising, but select the created advertising provider.
3. Register a host for caching commercials using the ADS_ADSTREAM_HOST_REPLACE option.
Advertising from external Qvol provider
1. Create an advertising provider object using the External Ad Provider object in the service administration panel (the API domain is requested from the advertising provider or a manager from Microimpuls).
2. Create an advertising unit using the same principle as for internal advertising, but select the created advertising provider.
3. Configure the ADS_EPG_USE_CATEGORIES_AS_GENRES option to select what exactly to send to the provider about the current program: genre or category.4. Register a host for caching commercials using the ADS_QVOL_HOST_REPLACE option (if necessary, commercials can also be broadcast directly from the provider).