LogoLogo
  • Platform Overview
  • 🗺️Guides
    • Getting Started
    • Users
      • Integrate the User SDK
      • Registration
      • Authentication
      • SDK Releases
      • API Reference
    • Entitlements
      • Administrative API
        • Integrating the Administrative API
        • Entitlement Definitions
        • Managing Entitlements Sets
        • Managing Entitlements Sequences
        • Managing User Entitlements
        • API Schema
      • End-user API
        • Integrate the Entitlements SDK
        • Redeeming Entitlements
        • Retrieving Entitlements
        • SDK Releases
        • API Reference
    • Sudos
      • Integrate the Sudo Profiles SDK
      • Sudo Entitlements
      • Manage Sudos
      • SDK Releases
      • API Reference
    • Telephony
      • Integrate the Telephony SDK
      • Manage Phone Numbers
      • Text Messaging
      • Voice Calling
      • Telephony Simulator
      • SDK Releases
      • API Reference
    • Email
      • Integrate the Email SDK
      • Email Entitlements
      • Manage Email Addresses
      • Sending & Receiving Email
      • Manage Email Folders
      • Draft Email Messages
      • Manage Email Address Blocklists
      • Email Address Public Information
      • Pagination
      • Caching
      • Configuration Data
      • Email Notifications
      • SDK Releases
      • API Reference
    • Decentralized Identity
      • Edge Agent
        • Relay SDK
          • Integrate the Relay SDK
          • Relay Entitlements
          • Manage Relay Postboxes
          • Manage Relay Messages
          • Receiving Messages
          • SDK Releases
        • Edge Agent SDK
          • Integrate the Edge Agent SDK
          • Agent Management
          • Manage Wallets
          • Establishing Connections
          • Manage Connections
          • Messaging
          • Manage DIDs
          • Accepting New Credentials
          • Manage Credentials
          • Present Credentials for Verification
          • Utilize Alternative Cryptography Providers
          • SDK Releases
          • Standards and Protocols
      • Cloud Agent
        • Cloud Agent Admin API
          • Integrate the Cloud Agent Admin API
          • Aries Interop Profile (AIP)
            • Connection Exchanges
            • Credential Exchanges
            • Proof Exchanges
          • Connections
          • Basic Messages
          • Credentials
            • Anoncreds Credentials
              • Schemas
              • Credential Definitions
            • W3C Credentials
          • Audit Logs
          • API Schema
          • Error Codes
          • Standards and Protocols
    • Virtual Cards
      • Integrate the Virtual Cards SDK
      • Virtual Cards Entitlements
      • Virtual Cards Transaction Velocity Constraints
      • Key Management
      • Manage Funding Sources
      • Manage Virtual Cards
      • Manage Transactions
      • Configuration Data
      • Pagination
      • Caching
      • SDK Releases
      • API Reference
    • Virtual Cards Simulator
      • Integrate the Virtual Cards Simulator SDK
      • Simulate Authorizations
      • Simulate Debits
      • Simulate Refunds
      • Simulate Reversals
      • Merchants and Currencies
      • SDK Releases
      • API Reference
    • Virtual Private Network
      • Integrate the VPN SDK
      • VPN Entitlements
      • Manage Servers
      • Manage Connection
      • Observe VPN Related Events
      • SDK Releases
      • API Reference
      • Frequently Asked Questions
    • Secure ID Verification
      • Integrate the Secure ID Verification SDK
      • List Supported Countries
      • Verify an Identity
      • Check Secure ID Verification Status
      • Use the Secure ID Verification Simulator
      • SDK Releases
      • API Reference
    • Password Manager
      • Integrate the Password Manager SDK
      • Accessing the Password Manager
      • Managing Password Vaults
      • Managing Password Vault Items
      • Vault Import and Export
      • Password Utilities
      • Password Manager Entitlements
      • Password Vault Security
      • SDK Releases
      • API Reference
    • Ad/Tracker Blocker
      • Integrate the Ad/Tracker Blocker SDK
      • Manage Rulesets
      • Blocking Ads and Trackers
      • Manage Exceptions
      • SDK Releases
      • API Reference
    • Site Reputation
      • Integrate the Site Reputation SDK
      • Use the Site Reputation SDK
      • SDK Releases
      • API Reference
  • 💡Concepts
    • Sudo Digital Identities
  • 🧱Development
    • Versioning
  • 🏢Administration
    • Admin Console Roles
  • ❓Get Help
    • Request a Demo
    • Report an Issue
Powered by GitBook
On this page
  • List the Available Rulesets
  • Update Rulesets
  • Getting the Active Rulesets
  • Setting the Active Rulesets
  1. Guides
  2. Ad/Tracker Blocker

Manage Rulesets

Provides control over which sets of advertising, tracker and social media blocking rules are active.

PreviousIntegrate the Ad/Tracker Blocker SDKNextBlocking Ads and Trackers

Last updated 28 days ago

Rulesets are a collection of patterns that the blocking engine can use to identify advertisements and tracking requests. The SDK provides methods to specify which rulesets are active, making it easy to customize the user's browsing experience.

List the Available Rulesets

To list all the available rulesets offered by the Ad/Tracker Blocker SDK you can use the listRulesets method to retrieve the metadata of all the rulesets.

const rulesets: Rulesets[] = await client.listRulesets()
do {
    let rulesets = try await client.listRulesets()
} catch {
    // Handle failure
}
// val client: SudoAdTrackerBlockerClient

launch {
    try {
        val rulesets = withContext(Dispatchers.IO) {
            client.listRulesets()
        }
        // Find the advertising blocking ruleset
        val adBlockRuleset = rulesets.find { ruleset ->
            ruleset.type == Ruleset.Type.AD_BLOCKING 
        }
    } catch (e: SudoAdTrackerBlockerException) {
        // Handle/notify user of exception
    }
}

The metadata of each ruleset provides the following elements.

type

Category of the ruleset. For example: Advertising, Privacy or Social Media

updatedAt

The date/time of when the ruleset was last updated by the Ad/Tracker Blocker service

Update Rulesets

To ensure that your users are protected by the very latest version of the ad and tracker blocking rulesets you can periodically request that the SDK re-fetches the rulesets by calling the updateRulesets method.

On iOS, the latest ruleset data is always returned when your application requests content blocker data from the SDK. See .

/*
 * The `updateRulesets` method returns a promise that
 * resolves when rulesets have been updated.
 *
 * The rulesets are cached via the StorageProvider 
 * provided to the client.
 */

await client.updateRulesets()
// val client: SudoAdTrackerBlockerClient

launch {
    try {
        withContext(Dispatchers.IO) {
            // For example, if only interested in ads and privacy blocking
            client.updateRulesets(
                Ruleset.Type.AD_BLOCKING,
                Ruleset.Type.PRIVACY
            )
        }
    } catch (e: SudoAdTrackerBlockerException) {
        // Handle/notify user of exception
    }
}

The updateRulesets method performs an HTTP request to update the rulesets. The source of a ruleset is large, typically from 0.5 to over 1 MB. This means that this operation might take some time to complete.

Getting the Active Rulesets

You can allow your users to control which sets of blocking rules are active at any time. To find the current set of active rulesets call the getActiveRulesets method.

const activeRulesets: RulesetType[] = await client.getActiveRulesets()
// val client: SudoAdTrackerBlockerClient

launch {
    try {
        val activeRulesets = withContext(Dispatchers.IO) {
            client.getActiveRulesets()
        }
        println("Active rulesets: $activeRulesets")
    } catch (e: SudoAdTrackerBlockerException) {
        // Handle/notify user of exception
    }
}

Setting the Active Rulesets

You can allow your users to control which sets of blocking rules are active at any time. The rulesets that are currently active can be controlled by calling the setActiveRulesets method.

import { RulesetType } from '@sudoplatform/sudo-ad-tracker-blocker'

/* 
 * The `setActiveRulesets` will change the active rulesets
 * in use by the client's filtering engine, and it will
 * save the updated preference via the storage provider.
 */

await client.setActiveRulesets([
  RulesetType.AdBlocking, 
  RulesetType.Privacy
])
// val client: SudoAdTrackerBlockerClient

launch {
    try {
        withContext(Dispatchers.IO) {
            // For example, if only interested in ads and privacy blocking
            client.setActiveRulesets(
                Ruleset.Type.AD_BLOCKING,
                Ruleset.Type.PRIVACY
            )
        }
    } catch (e: SudoAdTrackerBlockerException) {
        // Handle/notify user of exception
    }
}

On iOS, your application can control which content blockers to add to a custom web view. If your application provides a Content Blocking Extension, your users can enable or disable your content blocker(s) in system settings. See .

On iOS, your application can control which content blockers to add to a custom web view. If your application provides a Content Blocking Extension, your users can enable or disable your content blocker(s) in system settings. See .

When you change the active rulesets, the filtering engine will be reinitialized with the new rulesets. This is not instantaneous, it can take a small amount of time. To monitor the status of the filtering engine you can monitor the statusproperty as described in .

🗺️
Blocking Ads and Trackers on iOS
Blocking Ads and Trackers on iOS
Blocking Ads and Trackers on iOS
Filtering Status