# Troubleshoot campaigns

> Sometimes, a campaign might not trigger the effects you expect. Here are a few ways you can use to troubleshoot your campaigns. Most of these tips assume you have admin access.

> For the complete documentation index, see [llms.txt](https://docs.talon.one/llms.txt).

## Rule troubleshooting

### Check the status, budget, and evaluation

Ensure the following properties of your campaign are correct:

- **Status**: Ensure the campaign is **Active** in the **Campaigns** entry of your
  Application.
- **Budget**: Ensure that any configured budget is within its limit. A session which
  would exceed a campaign's budget will not trigger effects in that campaign.
- **Evaluation**: If your campaign isn't registering any effect, ensure that it is in the
  right evaluation group in the Application's [Campaign Evaluation](/docs/product/applications/manage-campaign-evaluation.md)
  page. Ensure there isn't another campaign in a group with an exclusive evaluation mode
  blocking your campaign from running.

### Review conditions and effects

Check the setup of your rules:

1. Check for typos in any validated attributes.
1. Rules are evaluated in the order they are displayed in the campaign, so ensure
   rules and effects are in the right sequence.
1. Review if the effects are logical. Effects do not fire when the effect
   doesn't make sense. For example: negative discounts, webhooks with blank
   payloads...

:::important
If one effect in a rule fails, then the other effects in the same rule
will also fail.
:::

### Add a Coupon Code is Valid condition

If your campaign doesn't have coupons, it can be helpful to add a coupon and a
**coupon code is valid** condition.

This returns a [Coupon Rejection
Reason](/docs/dev/integration-api/api-effects/#rejectcoupon) in the
response, which can identify a more specific reason the campaign is not behaving as you
expect.

### Add a Create a Notification effect

Use the **Create a notification** effect and use it to display any attribute or cart
filter value.

## Check if the API key is valid

Ensure that the API key of your Application has not yet expired. Click **Settings** \>
**Developers settings** in the Application's left-side menu.

In the **API Keys** section, check the status of all the API keys of the Application. If
none of them is active, [generate a new one](/docs/product/applications/manage-api-keys.md)
and run your campaign again to check if the problem has been resolved.

## Copy the campaign into a Testing Application

If the campaign to troubleshoot is in a production environment, you can duplicate the
campaign into a sandbox or testing Application:

1. Open your Application.
1. Click **Campaigns** in the left menu.
1. Click <Copy className="icon"/> in the **Copy** column.
1. Choose the Applications to which you want to copy the campaign.
1. Ensure that there is a [valid API key](#check-if-the-api-key-is-valid) for the target Application.

## Use the API Tester

Send a test session to the campaign using the API tester. You can also use
[Postman](https://www.postman.com/) or any other API platform if you prefer.

## Check the sessions and events pages

Every customer transaction in your integration takes place over a [customer
session](/docs/dev/concepts/entities/customer-sessions). Sessions are
typically composed of multiple
[events](/docs/dev/concepts/entities/events.md), usually a few session
update events, followed by one session close event.

When debugging, identify one specific session that did not perform as
expected. If you do not already have one, use
the [Sessions view](/docs/product/applications/display-customer-sessions.md) to navigate
through multiple sessions and find a valuable example.

After you have identified an
example session, look at the session's
attributes and cart items, and compare with what is used in the given campaign.

To display a session's effects:

1. Open the Application of your choice.
1. On the left-side menu, click <Sessions className="icon"/> **Sessions**.
1. Click the session of your choice and display the triggered effects.

Use the [Events view](/docs/product/applications/display-events.md) to scan events from
multiple sessions and display the triggered effects for each event.

To display an Application's events:

1. Open the Application of your choice.
1. On the left-side menu, click <Events className="icon"/> **Events**.

:::note
Some behaviors (like
updating a coupon's redemption counter) only occur or persist on session close. When
testing, ensure to close the test session to observe the entire behavior.
:::

## Check the logs

### Check the audit logs

If you are unable to recreate the issue and it has not been observed recently, check
the history of the campaign's rules. This way, you can see if any
discrepancies were caused by a changed rule.

You can do this by checking the [audit logs](/docs/product/account/logs/audit-logs.md).

You can export changes to a specific campaign by the [List campaign Rulesets endpoint in
the Management API](/management-api#tag/Campaigns/operation/getRulesets).

### Check the Integration API log

After you've found a session ID and checked the effects in the Events table,
search the [Integration API logs](/docs/product/account/logs/integration-api-logs.md) for your deployment.
In the logs, you can search for a specific session by filtering the path, like
`customer_sessions/your_session_id`.

In this view, you can view the full API request and response via the two tabs within a log
entry.

### Coupon rejections reasons

See [Display coupon rejection reasons](/docs/product/applications/find-coupons.md#display-coupon-rejection-reasons).

## Related pages

- [Manage campaign budgets](/docs/product/campaigns/settings/manage-campaign-budgets.md)
- [Manage general settings](/docs/product/applications/manage-general-settings.md)
