---
title: Create a No Action Handler
slug: sdks/no-action-handler
description: How to create an action that discards collected data and does nothing for the React Native, iOS, and Android versions of the Monetate SDK
image:  https://archbee-image-uploads.s3.amazonaws.com/ceIfEvQHzQk1IVxoRWUh7/K9eTL4jKm7UQINb6zNziJ-20250912-181225.png
docTags: 
createdAt: 2024-07-22T18:41:18.398Z
---



:::BlockQuote
**Note :**&#x54;his legacy flow remains supported for backward compatibility.New integrations are recommended to use the Context Layer–based getActions() approach.[ check below](https://developer.monetate.com/sdks/no-action-handler#hSB5a)
:::

In some cases when you trigger an action, you might want to discard the collected data and do nothing. In these cases, you can direct the [getActions](docId\:F5SIeJXaS3hi38DaXdVPy) or [getActionsData](docId\:F5SIeJXaS3hi38DaXdVPy) method to perform no action. No data is returned in this case. Use this option to improve performance when you don't want to alter your site or the collected data.

## getActions

Reports an event and immediately requests a decision from Monetate.

:::::Tabs
::::Tab{title="React Native"}
:::CodeblockTabs
getActions Method

```javascript
getActions(actionType, context?, eventData?, includeReporting?) : Promise<any>
```
:::

The parameters are as follows:

- `actionType` is the type of action you want to request. You can specify one action or multiple actions in an array to handle.
- `context` is name of the event.
- `eventData` is the data associated with the event.
- `includeReporting` indicates whether the response will have impression reporting data.

Use `NoAction` as the action type for this method.
::::

::::Tab{title="React Web"}
:::CodeblockTabs
getActions Method

```javascript
getActions(actionType, context?, eventData?, includeReporting?) : Promise<any>
```
:::

The parameters are as follows:

- `actionType` is the type of action you want to request. You can specify one action or multiple actions in an array to handle.
- `context` is name of the event.
- `eventData` is the data associated with the event.
- `includeReporting` indicates whether the response will have impression reporting data.

Use `NoAction` as the action type for this method.
::::

::::Tab{title="iOS"}
:::CodeblockTabs
getActions Method

```swift
objPersonalization.getActions(context: <ContextEnum>, requestId: <String>, includeReporting: <Bool>, arrActionTypes: <[String]>, event: <MEvent?>)
```
:::

Parameters:

- `context` is name of the event.
- `requestID` is the request ID for the API.
- `includeReporting` indicates whether the response will have impression reporting data.
- `arrActionTypes` is the type of actions you want to request. You can specify multiple actions in an array to handle.
- `event` is the data associated with the event.

Use `NoAction` as the action type for this method.
::::

::::Tab{title="Android"}
:::CodeblockTabs
getActions Method

```java
public String getActions(String context, Object event, String[] actionTypes, boolean includeReports) {returns response;}
```
:::

The parameters are as follows:

- `actionTypes` is the type of action you want to request. You can specify one action or multiple actions in an array to handle.
- `context` is name of the event.
- `eventData` is the data associated with the event.
- `includeReporting` indicates whether the response will have impression reporting data.

Use `NoAction` as the action type for this method.
::::
:::::

### Code Example

:::::Tabs
::::Tab{title="React Native"}
:::CodeblockTabs
getActions Example

```javascript
let recData;
personalizationInstance
  .getActions("monetate:action:NoAction")
  .then(res =>
  {
    recsData = res[0].actions;
  })
  .catch(error =>
  {
    console.warn('Error!', error);
  });
```
:::
::::

::::Tab{title="React Web"}
:::CodeblockTabs
getActions Example

```javascript
let recData;
personalizationInstance
  .getActions("monetate:action:NoAction")
  .then(res =>
  {
    recsData = res[0].actions;
  })
  .catch(error =>
  {
    console.warn('Error!', error);
  });
```
:::
::::

::::Tab{title="iOS"}
:::CodeblockTabs
getActions Example

```swift
import MarqueeLabel
import UIKit
import monetate_ios_sdk

class CategoryViewController: UIViewController {
  final var objPersonalization = Personalization(
    account: Account(
      instance: "p", domain: "localhost.org", name: "a-701b337c", shortname: "localhost"),
    user: User(deviceId: "62bd2e2d-213d-463f-83bb-12c0b2530a14"))
  override func viewDidLoad() {
    super.viewDidLoad()
  }
  override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    noActionEvent()
  }
  func noActionEvent() {
    objPersonalization.getActions(
      context: .PageView, requestId: "test_request_id",
      includeReporting: true,
      arrActionTypes: ["monetate:action:NoAction"],
      event: PageView(
        pageType: "Homepage", path: "n/a", url: "n/a",
        categories: [], breadcrumbs: [])
    ).on { (res) in
      if res.status == 200 {
        let data = JSON(res.data)
        print(data)
        self.handleAction(res: res)
      } else {
      }
    }
  }
}
```
:::
::::

::::Tab{title="Android"}
:::CodeblockTabs
getActions Example

```java
String data = personalization.getActions(EventTypes.ContextIpAddress,
  new IpAddress("1.0.0.0"),
  new String[]
  {
    "monetate:action:NoAction"
  },
  true);
```
:::
::::
:::::

## getActionsData

Requests an experience decision from Monetate based off the action type.

:::::Tabs
::::Tab{title="React Native"}
:::CodeblockTabs
getActionsData Method

```javascript
getActionsData(actionType: Array<string>, includeReporting?: boolean) : Promise<any>
```
:::

The parameters are as follows:

- `actionTypes` is the type of action you want to request. You can specify one action or multiple actions in an array to handle.
- `includeReports` indicates whether the response will have impression reporting data.

Use `NoAction` as the action type for this method.
::::

::::Tab{title="React Web"}
:::CodeblockTabs
getActionsData Method

```javascript
getActionsData(actionType: Array<string>, includeReporting?: boolean) : Promise<any>
```
:::

The parameters are as follows:

- `actionTypes` is the type of action you want to request. You can specify one action or multiple actions in an array to handle.
- `includeReports` indicates whether the response will have impression reporting data.

Use `NoAction` as the action type for this method.
::::

::::Tab{title="iOS"}
:::CodeblockTabs
getActionsData Method

```swift
getActionsData(requestId: <String>, includeReporting: <Bool>, arrActionTypes: <[String]>) 
```
:::

The parameters are as follows:

- `requestID` is the request ID for the API.
- `includeReporting` indicates whether the response will have impression reporting data.
- `arrActionTypes` is the type of actions you want to request. You can specify multiple actions in an array to handle.

Use `NoAction` as the action type for this method.
::::

::::Tab{title="Android"}
:::CodeblockTabs
getActionsData Method

```java
public String getActionsData(String[] actionTypes, boolean includeReports)
```
:::

The parameters are as follows:

- `actionTypes` is the type of action you want to request. You can specify one action or multiple actions in an array to handle.
- `includeReports` indicates whether the response will have impression reporting data.

Use `NoAction` as the action type for this method.
::::
:::::

## NoAction using  Context Layer&#x20;

<font color="#15803D">**Supported SDK Versions**</font>

- <font color="#4283c7">**Android**</font>: 1.0.6-A or later&#x20;
- <font color="#4283c7">**React-Native**</font>: 1.0.6-RN or later&#x20;
- <font color="#4283c7">**Web**</font>: 1.0.6-W or later&#x20;
- <font color="#4283c7">**iOS**</font>**:** 2026.01.06 or later



Using the new **Context Layer–based approach**, **NoAction** Actions can be implemented using a enhanced **getActions()&#x20;**&#x6D;ethod. Below is the sample code snippet demonstrating this usage.

For detailed information on the enhanced getActions() flow, please refer to the **[Context](https://developer.monetate.com/sdks/objects#mDSKQ)** and **[getActions](https://developer.monetate.com/sdks/getactions)** sections.

## Code Eample

:::::Tabs
::::Tab{title="iOS"}
:::CodeblockTabs
getActions method

```swift
public func getActions(context:ContextObj,arrActionTypes:[String],includeReporting: Bool)
```
:::
::::

::::Tab{title="Android"}
:::CodeblockTabs
getActions method

```java
public void getActions(Context context, String[] actionTypes, boolean includeReports, ActionsCallback actionsCallback) {
```
:::

## Full Code Exmaple
::::

::::Tab{title="React-Native"}
:::CodeblockTabs{indent="2"}
getAction Method New

```typescript
 async getActions(
        actionType: string | string[],
        context?: any,
        includeReporting: boolean = true,
        errorCallback?: (result: { status: "success" | "failed"; error?: unknown }) => void
    ): Promise<{ data: unknown; errors?: unknown }> {}

```
:::
::::

::::Tab{title="Web"}
:::CodeblockTabs{indent="2"}
getAction Method New

```typescript
 async getActions(
        actionType: string | string[],
        context?: any,
        includeReporting: boolean = true,
        errorCallback?: (result: { status: "success" | "failed"; error?: unknown }) => void
    ): Promise<{ data: unknown; errors?: unknown }> {}

```
:::
::::
:::::

:::::Tabs
::::Tab{title="IOS"}
:::CodeblockTabs
Targeting NoAction using getActions

```swift
 let contextObj = ContextObj()
        // setting up context data
        contextObj.addIpAddress("1.0.0.0")  
        //Request No Action data
        objPersonalization.getActions(context: contextObj, arrActionTypennelRecommendation"], includeReporting: false)
            .on(success: { (actions) in
                    self.handleRecommendations(actions: actions)
            })
    }
```
:::
::::

::::Tab{title="Android"}
:::CodeblockTabs
getActions Example

```java
// setting up context data
Context context = new Context();
context.addIpAddress("1.0.0.0");	
//Request Banner Action data	
personalization.getActions(context, new String[] {"monetate:action:NoAction"}, false,new ActionsCallback() {
	@Override
	public void onSuccess(String actions) {
	        // print data received
			System.out.println("Action data :"+actions);		
	}
	@Override
	public void onError(Exception e) {
	        // prints if any error or exception occur
			System.out.println("Ex :"+e);					
		}
 });
```
:::
::::

::::Tab{title="React-Native"}
:::CodeblockTabs{indent="2"}
getAction Example

```typescript
  const context = new Context();
  context.addIpAddress("1.0.0.0");	
  
  Personalization.getActions(
  ["monetate:action:NoAction"], 
  monetateContext)
  .then((res: any) => console.log("Action === 1 res", res));
```
:::
::::

::::Tab{title="Web"}
:::CodeblockTabs{indent="2"}
getAction Example

```typescript
  const context = new Context();
  context.addIpAddress("1.0.0.0");	
  
  Personalization.getActions(
  ["monetate:action:NoAction"], 
  monetateContext)
  .then((res: any) => console.log("Action === res", res));
```
:::
::::
:::::






