adcorelib

module
v0.0.0-...-277150b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2026 License: Apache-2.0

README

AdCoreLib - Core Functions Library for Advertising Software

Build Status Go Report Card GoDoc Coverage Status

AdCoreLib is a library of core functions for advertising software, intended for personal and company use. It supports the development of internal advertising services but prohibits providing commercial services to other companies and individuals.

This project contains common library packages for advertising software.

Features

Prices Math
  • CommissionShareFactor: Represents the internal commission of the system.
  • RevenueShareFactor: Represents the revenue of the publisher or advertiser.

RevenueShareFactor is calculated as:

RevenueShareFactor = 1.0 - CommissionShareFactor

For example, if:

  • CommissionShareFactor = 10% (0.1)
  • RevenueShareFactor = 90% (0.9)
  • RevenueShareReduce = 10%

The new price calculation:

newPrice = (price * (1 - RevenueShareReduce)) - (price * CommissionShareFactor)

For example:

newPrice = price * (1 - 0.1) * (1 - 0.1) = 0.81
Source and Target Calculations

Source:

  • CommissionShareFactor and RevenueShareReduce
    • newPrice = (price * (1 - RevenueShareReduce)) - (price * CommissionShareFactor)

Target (Zone + Site, AccessPoint{DSP}):

  • CommissionShareFactor and RevenueShareReduce
    • publisherPrice = price - (price * CommissionShareFactor) - (price * RevenueShareReduce)

If the target has a fixed view price, that value can be used instead. If the target is an AccessPoint, RevenueShareReduce will reduce discrepancy.

We have two types of commissions:

  1. From source to reduce discrepancy between buyer (DSP) and seller.
  2. From target.
Example Price Calculation

Price

  • CorrectedSourcePrice = OriginalSourcePrice - Discrepancy
  • CorrectedPrice = CorrectedSourcePrice - TargetShareReduce
  • ComissionPrice = CorrectedPrice % (1 - RevShare)
  • PurchasePrice = CorrectedPrice - ComissionPrice

TODO

  • Add documentation
  • Reorganize package structure

License

LICENSE

Copyright 2024 Dmitry Ponomarev & Geniusrabbit

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
adformattest
Package adformattest provides test fixtures for adformat — the counterpart of admodels/types.MockFormats(), but backed by embed.FS (via adformat/examples) instead of the old, fragile runtime.Caller(1) + os.Open("../assets/...") pair, which broke when a package was moved or vendored.
Package adformattest provides test fixtures for adformat — the counterpart of admodels/types.MockFormats(), but backed by embed.FS (via adformat/examples) instead of the old, fragile runtime.Caller(1) + os.Open("../assets/...") pair, which broke when a package was moved or vendored.
examples
Package examples embeds the adformat/examples/*.yaml sample formats (§4 of the design plan) via embed.FS, so they can be loaded without a fragile runtime.Caller + os.Open dance (the old admodels/types/format_mock.go approach) and reused both by tests and by adformat/adformattest.
Package examples embeds the adformat/examples/*.yaml sample formats (§4 of the design plan) via embed.FS, so they can be loaded without a fragile runtime.Caller + os.Open dance (the old admodels/types/format_mock.go approach) and reused both by tests and by adformat/adformattest.
openrtbnative
Package openrtbnative is a reference adformat.Binding adapter (§3.2.12) associating adformat assets/fields with OpenRTB Native 1.2 asset objects — a concrete, typed replacement for the name-based guessing that adsource-openrtb currently does (see adsource-openrtb/request/v2/builder.go), and for the always-empty FormatFileRequirement.ID/FormatField.ID of the old model.
Package openrtbnative is a reference adformat.Binding adapter (§3.2.12) associating adformat assets/fields with OpenRTB Native 1.2 asset objects — a concrete, typed replacement for the name-based guessing that adsource-openrtb currently does (see adsource-openrtb/request/v2/builder.go), and for the always-empty FormatFileRequirement.ID/FormatField.ID of the old model.
openrtbvideo
Package openrtbvideo is a reference adformat.Binding adapter (§3.2.12) associating a whole adformat.Format with an OpenRTB Video object's properties.
Package openrtbvideo is a reference adformat.Binding adapter (§3.2.12) associating a whole adformat.Format with an OpenRTB Video object's properties.
tracking
Package tracking is a reference adformat.Binding adapter (§3.2.16) for protocol-agnostic fire-and-forget impression/click tracking pixels, applicable to any Format.Kind (native/banner/push/direct).
Package tracking is a reference adformat.Binding adapter (§3.2.16) for protocol-agnostic fire-and-forget impression/click tracking pixels, applicable to any Format.Kind (native/banner/push/direct).
vasttracking
Package vasttracking is a reference adformat.Binding adapter (§3.2.16) for the full VAST 4.x tracking-event dictionary, used by in-stream video creatives (Format.Kind == KindVideo).
Package vasttracking is a reference adformat.Binding adapter (§3.2.16) for the full VAST 4.x tracking-event dictionary, used by in-stream video creatives (Format.Kind == KindVideo).
adquery
prices
Package prices provides embeddable price scopes for advertisement campaigns and separate actions performed on them.
Package prices provides embeddable price scopes for advertisement campaigns and separate actions performed on them.
trafaret
Package trafaret fills impression slots from a priority-weighted pool of ads.
Package trafaret fills impression slots from a priority-weighted pool of ads.
context
eventtraking
package httpserver provides basic HTTP server with DSP handlers
package httpserver provides basic HTTP server with DSP handlers
i18n
Package msgpack provides premetive methods and object for message pack and unpacking
Package msgpack provides premetive methods and object for message pack and unpacking
net
httpclient
Package httpclient provides an abstraction layer for HTTP client operations.
Package httpclient provides an abstraction layer for HTTP client operations.
httpclient/batchclient
Package batchclient provides high-performance batch execution capabilities for HTTP requests.
Package batchclient provides high-performance batch execution capabilities for HTTP requests.
platform

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL