# Console Commands

Run these in your browser's developer console (F12 or Cmd+Option+I) to inspect Shoplift's state.

#### Enable debug logging

Turns on verbose console logging for all Shoplift operations. Persists across page loads.

```javascript
// Enable
window.shopliftInstance.setDebug(true);

// Disable
window.shopliftInstance.setDebug(false);
```

#### Dump full internal state

Outputs Shoplift's complete internal state object to the console — useful for support tickets or deep debugging.

```javascript
window.shopliftInstance.debug();
```

#### Check if Shoplift is loaded

```javascript
console.log(window.shoplift);
// Should log an object with isHypothesisActive, setAnalyticsConsent, getVisitorData
```

#### Inspect visitor data

```javascript
const data = window.shoplift.getVisitorData();
console.log('Visitor:', data.visitor);
console.log('Tests:', data.visitorTests);
```

#### View visitor data as a table

```javascript
console.table(window.shoplift.getVisitorData().visitor);
```

#### List all active test assignments

```javascript
window.shoplift.getVisitorData().visitorTests.forEach((t) => {
  console.log(`${t.testId} → ${t.hypothesisId} (${t.isThemeTest ? 'theme' : 'element'})`);
});
```

#### Test a specific hypothesis

```javascript
const result = await window.shoplift.isHypothesisActive('your-hypothesis-id');
console.log('In variant:', result);
```

#### Check consent state

```javascript
const data = window.shoplift.getVisitorData();
console.log('Visitor exists:', !!data.visitor);
console.log('Tests tracked:', data.visitorTests.length);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shoplift.ai/api-reference/debugging-and-testing/console-commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
