# Trigger with code

Use the  `survey` command with the **Key** to trigger a Survey. If the Survey is already loaded, the function will return the existing instance, making it safe to call multiple times.

```js
const survey = await window.Frill('survey', {
  key: 'YOUR_SURVEY_KEY', // <-- Add Survey key here
  callbacks: {
    onReady(survey) {
      console.log(survey);
    },
  },
});
```

Triggering a Survey will ignore all targeting rules (e.g. URL matching and segmentation), but frequency (re-show) rules will still apply unless you have enabled the **"Ignore frequency rules when triggered with code"** option.

The Survey will not open if another survey is already open, even if you have chosen to ignore frequency rules. You can skip this check with the [force option](#force-show).

### Force show

You can force a Survey to open by setting `force: true` in your `survey` command.

```typescript
const survey = await window.Frill('survey', {
  key: 'YOUR_SURVEY_KEY', // <-- Add Survey key here
  force: true,
});
```
