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
  • Get the Exceptions List
  • Add to the Exceptions List
  • Remove from the Exceptions List
  • Removing all the Entries from the Exceptions List
  1. Guides
  2. Ad/Tracker Blocker

Manage Exceptions

Provides control over which URLs are given an exception from being blocked.

You can control which URLs are permitted to bypass the blocking rules by granting an exception for a specific web page, or an entire host. However, on iOS, exceptions may only be applied to an entire host.

Get the Exceptions List

To get the list of exceptions you can use the getExceptions method.

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

const exceptions: FilterException[] = await client.getExceptions()
let client: SudoAdTrackerBlockerClient!
let exceptions = await client.getExceptions()
// val client: SudoAdTrackerBlockerClient

launch {
    try {
        val isMySiteExcepted = withContext(Dispatchers.IO) {
            client.getExceptions().firstOrNull { exc ->
                exc.source.contains("http://myfavourite.domain.eu")
            }        
        } ?: false
    } catch (e: SudoAdTrackerBlockerException) {
        // Handle/notify user of exception
    }
}

Add to the Exceptions List

To add to the list of exceptions you can use the addExceptions method. You can add the URL of a single page or an entire host to the list of exceptions.

On iOS, exceptions may only apply to an entire host.

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

const hostException: FilterException = {
  // `type` === 'host' prevents blocking on 
  // any pages at `example.com`.
  type: 'host',
  source: 'http://example.com/page.html'
}

const pageException: FilterException = {
  // `type` === 'page' prevents blocking on 
  // only `example.com/page.html`.
  type: 'page',
  source: 'https://example.com/page.html'
}

// Add both exceptions to the exceptions list
await client.addExceptions([
  hostException, 
  pageException
])
let client: SudoAdTrackerBlockerClient!
await client.addExceptions([BlockingException("example.com")])
// val client: SudoAdTrackerBlockerClient

launch {
    try {
        withContext(Dispatchers.IO) {
            client.addExceptions(
                toHostException("http://somehost.com"),
                toPageException("http://myfavourite.domain.eu/homepage")
            )
        }
    } catch (e: SudoAdTrackerBlockerException) {
        // Handle/notify user of exception
    }
}

Remove from the Exceptions List

To remove from the list of exceptions you can use the removeExceptions method. You should supply the same exception value(s) you used when you added the page or host to the list of exceptions.

const exception: FilterException = {
  type: 'host',
  source: 'http://example.com/page.html'
}

/*
 * The `removeExceptions` method returns a Promise that will
 * resolve when the exception has been removed from the 
 * storage provider provided to the client.
 *
 * In this case the removed exception will be for all pages 
 * of `example.com` since the exception is of type `host`.
 */

await client.removeExceptions([exception])
let client: SudoAdTrackerBlockerClient!
await client.removeExceptions([BlockingException("example.com")])
// val client: SudoAdTrackerBlockerClient

launch {
    try {
        withContext(Dispatchers.IO) {
            client.removeExceptions(
                toHostException("http://somehost.com"),
                toPageException("http://myfavourite.domain.eu/homepage")
            )
        }
    } catch (e: SudoAdTrackerBlockerException) {
        // Handle/notify user of exception
    }
}

Removing all the Entries from the Exceptions List

To remove all entries from the list of exceptions you can use the removeAllExceptions method.

/*
 * The `removeAllExceptions` method returns a Promise that 
 * will resolve when the all of the exceptions have succesfully
 * been removed from the client's storage provider.
 */

await client.removeAllExceptions()
let client: SudoAdTrackerBlockerClient!
await client.removeAllExceptions()
// val client: SudoAdTrackerBlockerClient

launch {
    try {
        withContext(Dispatchers.IO) {
            client.removeAllExceptions()
        }
    } catch (e: SudoAdTrackerBlockerException) {
        // Handle/notify user of exception
    }
}
PreviousBlocking Ads and TrackersNextSDK Releases

Last updated 1 month ago

🗺️