---
title: "lifecycle Plugin"
description: "Hook into the plugin lifecycle to run code on setup and teardown"
url: "https://www.contentstack.com/docs/lytics/jstag-plugin-lifecycle"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-08-03"
---

# lifecycle Plugin

Hook into the plugin lifecycle to run code on setup and teardown

## \`lifecycle\` plugin

Hook into the plugin lifecycle. Run code on setup and teardown.

Lifecycle

utility

### Events

Event

Fires when

Payload

lifecycle.setup.requested

Setup is requested

_none_

lifecycle.setup.done

immediately after lifecycle.setup.requested

_none_

lifecycle.teardown.requested

Teardown is requested

_none_

lifecycle.teardown.done

immediately after lifecycle.teardown.requested

_none_

[Learn more about events](/docs/lytics/jstag-events)