--- title: "Advertising" slug: "150-manage-advertising" updated: 2025-03-19T17:34:48Z published: 2025-03-19T17:34:48Z canonical: "docs.developer.comcast.com/150-manage-advertising" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.developer.comcast.com/llms.txt > Use this file to discover all available pages before exploring further. # Advertising **Advertising Module 1.5.0 | Manage SDK** ## Usage To use the Advertising module, you can import it into your project from the Firebolt SDK: ``` import { Advertising } from '@firebolt-js/manage-sdk' ``` ## Overview A module for platform provided advertising settings and functionality. ## Methods ### listen To listen to a specific event pass the event name as the first parameter: ``` listen(event: string, callback: (data: any) => void): Promise ``` Parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `event` | `string` | Yes | The event to listen for, see [Events](/docs/150-manage-advertising#events). | | *callback* | `function` | Yes | A function that will be invoked when the event occurs. | Promise resolution: | Type | Description | | --- | --- | | `number` | Listener ID to clear the callback method and stop receiving the event, e.g. `Advertising.clear(id)` | Callback parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `data` | `any` | Yes | The event data, which depends on which event is firing, see [Events](/docs/150-manage-advertising#events). | To listen to all events from this module pass only a callback, without specifying an event name: ``` listen(callback: (event: string, data: any) => void): Promise ``` Parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | *callback* | `function` | Yes | A function that will be invoked when the event occurs. The event data depends on which event is firing, see [Events](/docs/150-manage-advertising#events). | Callback parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `event` | `string` | Yes | The event that has occured listen for, see [Events](/docs/150-manage-advertising#events). | | `data` | `any` | Yes | The event data, which depends on which event is firing, see [Events](/docs/150-manage-advertising#events). | Promise resolution: | Type | Description | | --- | --- | | `number` | Listener ID to clear the callback method and stop receiving the event, e.g. `Advertising.clear(id)` | See [Listening for events](/docs/listening-for-events/) for more information and examples. ### once To listen to a single instance of a specific event pass the event name as the first parameter: ``` once(event: string, callback: (data: any) => void): Promise ``` The `once` method will only pass the next instance of this event, and then dicard the listener you provided. Parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `event` | `string` | Yes | The event to listen for, see [Events](/docs/150-manage-advertising#events). | | *callback* | `function` | Yes | A function that will be invoked when the event occurs. | Promise resolution: | Type | Description | | --- | --- | | `number` | Listener ID to clear the callback method and stop receiving the event, e.g. `Advertising.clear(id)` | Callback parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `data` | `any` | Yes | The event data, which depends on which event is firing, see [Events](/docs/150-manage-advertising#events). | To listen to the next instance only of any events from this module pass only a callback, without specifying an event name: ``` once(callback: (event: string, data: any) => void): Promise ``` Parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | *callback* | `function` | Yes | A function that will be invoked when the event occurs. The event data depends on which event is firing, see [Events](/docs/150-manage-advertising#events). | Callback parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `event` | `string` | Yes | The event that has occured listen for, see [Events](/docs/150-manage-advertising#events). | | `data` | `any` | Yes | The event data, which depends on which event is firing, see [Events](/docs/150-manage-advertising#events). | Promise resolution: | Type | Description | | --- | --- | | `number` | Listener ID to clear the callback method and stop receiving the event, e.g. `Advertising.clear(id)` | See [Listening for events](/docs/listening-for-events/) for more information and examples. ### resetIdentifier Resets a user's identifier in the ad platform so that the advertising id that apps get will be a new value ``` function resetIdentifier(): Promise ``` Promise resolution: Capabilities: | Role | Capability | | --- | --- | | manages | xrn:firebolt:capability:advertising:identifier | #### Examples Default Example JavaScript: ``` import { Advertising } from '@firebolt-js/manage-sdk' let result = await Advertising.resetIdentifier() console.log(result) ``` Value of `result`: ``` null ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Advertising.resetIdentifier", "params": {} } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` --- ### skipRestriction Set the value for AdPolicy.skipRestriction To get the value of `skipRestriction` call the method like this: ``` function skipRestriction(): Promise ``` Promise resolution: [SkipRestriction](/docs/150-manage-Advertising-schemas#SkipRestriction) Capabilities: | Role | Capability | | --- | --- | | manages | xrn:firebolt:capability:advertising:configuration | #### Examples Default Example JavaScript: ``` import { Advertising } from '@firebolt-js/manage-sdk' let result = await Advertising.skipRestriction() console.log(result) ``` Value of `result`: ``` 'none' ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Advertising.skipRestriction", "params": {} } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": "none" } ``` Additional Example JavaScript: ``` import { Advertising } from '@firebolt-js/manage-sdk' let result = await Advertising.skipRestriction() console.log(result) ``` Value of `result`: ``` 'none' ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Advertising.skipRestriction", "params": {} } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": "all" } ``` --- To set the value of `skipRestriction` call the method like this: ``` function skipRestriction(value: SkipRestriction): Promise ``` Parameters: | Param | Type | Required | Description | | --- | --- | --- | --- | | `value` | [`SkipRestriction`](/docs/150-manage-Advertising-schemas#SkipRestriction) | true | values: `'none' \| 'adsUnwatched' \| 'adsAll' \| 'all'` | Promise resolution: #### Examples Default Example JavaScript: ``` import { Advertising } from '@firebolt-js/manage-sdk' let result = await Advertising.skipRestriction('none') console.log(result) ``` Value of `result`: ``` null ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Advertising.setSkipRestriction", "params": { "value": "none" } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` Additional Example JavaScript: ``` import { Advertising } from '@firebolt-js/manage-sdk' let result = await Advertising.skipRestriction('all') console.log(result) ``` Value of `result`: ``` null ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Advertising.setSkipRestriction", "params": { "value": "all" } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` --- To subscribe to notifications when the value changes, call the method like this: ``` function skipRestriction(callback: (value) => SkipRestriction): Promise ``` Promise resolution: ``` number ``` #### Examples Default Example JavaScript: ``` import { Advertising } from '@firebolt-js/manage-sdk' let listenerId = await skipRestriction((value) => { console.log(value) }) console.log(listenerId) ``` Value of `result`: ``` 'none' ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Advertising.onSkipRestrictionChanged", "params": { "listen": true } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": "none" } ``` Additional Example JavaScript: ``` import { Advertising } from '@firebolt-js/manage-sdk' let listenerId = await skipRestriction((value) => { console.log(value) }) console.log(listenerId) ``` Value of `result`: ``` 'none' ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Advertising.onSkipRestrictionChanged", "params": { "listen": true } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": "all" } ``` --- ## Events ### skipRestrictionChanged See: [skipRestriction](/docs/150-manage-advertising#skiprestriction) ## Private Events **View** ### skipRestrictionChanged See: [skipRestriction](/docs/150-manage-advertising#skiprestriction) ## Types