Skip to content

Conversation

@vladislav-yermakov
Copy link
Collaborator

@vladislav-yermakov vladislav-yermakov commented Dec 18, 2025

This PR addresses the following issues:

Breaking changes:

  • OptableSDK.init(host:, app:, insecure:, useragent:) was replaced with OptableSDK.init(config:)
  • SDK now requires tenant and originSlug parameters to initialise, instead of host and app
  • OptableConfig was introduced to contain all configuration parameters for the SDK
  • OptableConfig supports dynamic changes of all parameters, such as host, path, apiKey, custopUserAgent and others.

Other changes:

  • Introduced IABConsent for automatically retrieving user consent according to the IAB Transparency & Consent Framework
  • Introduced AppTrackingTransparency to handle App Tracking Identifiers
  • Introduced OptableIdentifierType, OptableIdentifiers, and OptableIdentifierEncoder to support optable identifiers and normalisation
  • Introduced async/await SDK API for modern swift
  • Updated SDK Unit and Integration tests
  • Updated demo-ios-swift and demo-ios-objc to match new SDK APIs
  • Updated docs to reflect new APIs

@justadreamer
Copy link

@vladislav-yermakov could you please check the comments above ^ and also write a short description for this PR, like a summary of changes to the APIs. roughly there are 4 categories of changes:

  • public API
  • implementation (should not have changed dramatically, majority of features were preserved)
  • demo apps
  • tests

@eugenedorfman-optable eugenedorfman-optable marked this pull request as ready for review January 8, 2026 18:56
@justadreamer
Copy link

Here is how audience object is converted into GAM key-value pairs:

https://github.com/Optable/optable-web-sdk/blob/b1beb3e995e8bd5edad6987fe5c048fe359d80b3/lib/edge/targeting.ts#L148-L165

function TargetingKeyValues(tdata: TargetingResponse | null): TargetingKeyValues {
  const result: TargetingKeyValues = {};

  if (!tdata) {
    return result;
  }

  for (const identifiers of tdata.audience ?? []) {
    if (identifiers.keyspace) {
      if (!(identifiers.keyspace in result)) {
        result[identifiers.keyspace] = [];
      }
      result[identifiers.keyspace].push(...identifiers.ids.map((el) => el.id));
    }
  }

  return result;
}

audience is an array of objects:

    "audience": [
        {
            "provider": "optable.co",
            "ids": [
                {
                    "id": "15f30409"
                }
            ],
            "keyspace": "optable",
            "rtb_segtax": 5001
        }
    ],

each of these objects becomes a single key-value pair.

@justadreamer
Copy link

Re: setting targetingData.ortb2 to Prebid - seems it is done correctly in Android: https://github.com/Optable/optable-android-sdk/pull/35/files#diff-c55c975d4a7bd768528a4687e2fbc25857690b9457d09282cb847d1532d06867R152

@vladislav-yermakov
Copy link
Collaborator Author

@justadreamer Please review recent changes.

// MARK: - Ad Loading
- (void)loadGADAdWithTargetingData:(NSDictionary* _Nullable)targetingData {
GAMRequest *adRequest = [GAMRequest request];
adRequest.customTargeting = targetingData;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is incorrect, we need to extract and compose GAM targeting key(s) and value(s) from targetingData.audience. the key name is audience.keyspace the value is is coma separated ids. so for the below example:

"{\"audience\":[{\"provider\":\"optable.co\",\"keyspace\":\"optable-test\",\"rtb_segtax\":5001,\"ids\":[{\"id\":\"082793f9\"}]}],\"resolved_ids\":[\"v:0b5zRoKB03RnzAZJaneBN4\"],

it will be optable-test: 082793f9. but there may be more than one item under audience. so each item will have its keyspace and ids. we need a public method of the Optable SDK to produce this key values for GAM out of the targeting API response.

@justadreamer
Copy link

Almost there, there is an implementation flaw - where we don't properly extract keywords from targetingData.audidence and do not properly set targetingData.ortb2 subset into Prebid. Maybe these keywords and ortb2 extraction should be encapsulated and exposed as SDK public API methods. everything else is cosmetics.

@vladislav-yermakov
Copy link
Collaborator Author

Added OptableTargeting object to easily support extracting keywords and ortb2.
Updated demo-ios-swift & demo-ios-objc with new APIs, fixing all issues with targeting and keywords.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants