> ## Documentation Index
> Fetch the complete documentation index at: https://docs.taginsight.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating tracking plans

> Learn how to create and manage tracking plans in Tag Insight

## Overview

A tracking plan is your source of truth for data collection. It defines what events should be tracked, which variables they contain, and what values are expected. Tag Insight makes creating and maintaining tracking plans simple and efficient.

<img src="https://mintcdn.com/taginsight/poFMsZzsIjoQTyP7/images/7_tracking_plan_list@2x.png?fit=max&auto=format&n=poFMsZzsIjoQTyP7&q=85&s=fe0ac54e70291c46cdddc3d910c59dc0" alt="Tracking Plan List View" style={{borderRadius: "8px", margin: "20px 0"}} width="2364" height="1720" data-path="images/7_tracking_plan_list@2x.png" />

## Creating your first tracking plan

<Steps>
  <Step title="Navigate to tracking plans">
    From your project dashboard, click **Tracking Plans** in the navigation
  </Step>

  <Step title="Click new tracking plan">
    Select **+ New Tracking Plan** to start the creation process
  </Step>

  <Step title="Configure basic settings">
    * **Name**: Give your tracking plan a descriptive name
    * **Description**: Add details about its purpose
    * **Template**: Choose a starting template or start from scratch
  </Step>

  <Step title="Add events">
    Begin adding events that you want to track
  </Step>
</Steps>

## Understanding events

Events represent user interactions or system occurrences that you want to track.

<img src="https://mintcdn.com/taginsight/poFMsZzsIjoQTyP7/images/select_events_trackingplan.png?fit=max&auto=format&n=poFMsZzsIjoQTyP7&q=85&s=6ab269be38ad05359516e803b3a111b3" alt="Select Events for Tracking Plan" style={{borderRadius: "8px", margin: "20px 0"}} width="2842" height="1690" data-path="images/select_events_trackingplan.png" />

### Event structure

Each event contains:

* **Event Name**: The identifier (e.g., `page_view`, `add_to_cart`)
* **Description**: What this event represents
* **Variables**: The data points captured with this event
* **Trigger Conditions**: When this event should fire

### Common event types

<Tabs>
  <Tab title="Page views">
    ```javascript theme={null}
    {
      event: 'page_view',
      page_title: 'Product Detail Page',
      page_category: 'products',
      page_path: '/products/blue-shirt'
    }
    ```
  </Tab>

  <Tab title="E-commerce">
    ```javascript theme={null}
    {
      event: 'add_to_cart',
      ecommerce: {
        items: [{
          item_id: 'SKU123',
          item_name: 'Blue Shirt',
          price: 29.99,
          quantity: 1
        }]
      }
    }
    ```
  </Tab>

  <Tab title="User actions">
    ```javascript theme={null}
    {
      event: 'form_submit',
      form_name: 'newsletter_signup',
      form_position: 'footer',
      user_email: 'user@example.com'
    }
    ```
  </Tab>
</Tabs>

## Adding events to your tracking plan

### Method 1: Manual creation

<Steps>
  <Step title="Click add event">
    In your tracking plan, click **+ Add Event**
  </Step>

  <Step title="Fill event details">
    * **Event Name**: Use snake\_case (e.g., `product_view`)
    * **Event Label**: Human-readable name
    * **Description**: Detailed explanation of when this fires
    * **Category**: Group related events together
  </Step>

  <Step title="Add variables">
    For each variable in the event:

    * Click **+ Add Variable**
    * Set variable name, type, and validation rules
  </Step>

  <Step title="Save event">
    Review and save your event configuration
  </Step>
</Steps>

### Method 2: Using templates

Tag Insight provides pre-built templates for common implementations:

<CardGroup cols={2}>
  <Card title="Google Analytics 4" icon="google">
    Standard GA4 e-commerce and engagement events
  </Card>

  <Card title="Enhanced e-commerce" icon="shopping-cart">
    Complete e-commerce tracking setup
  </Card>

  <Card title="Media & publishing" icon="newspaper">
    Content engagement and reading time events
  </Card>

  <Card title="SaaS applications" icon="cloud">
    User lifecycle and feature usage events
  </Card>
</CardGroup>

To use a template:

1. Select **Templates** when creating a tracking plan
2. Choose your template
3. Customize events and variables as needed
4. Save your tracking plan

### Method 3: AI-powered import

Use the Detect Tracking Plan feature to automatically discover existing events:

<Note>
  This method requires the Tag Insight pixel to be installed on your site.
</Note>

<Steps>
  <Step title="Install pixel">
    Ensure the Tag Insight pixel is active on your site
  </Step>

  <Step title="Start detection">
    Click **Detect Tracking Plan** and set duration
  </Step>

  <Step title="Browse your site">
    Navigate through your site to trigger events
  </Step>

  <Step title="Import results">
    Review detected events and import selected ones
  </Step>
</Steps>

## Configuring variables

Variables are the individual data points within each event.

### Variable properties

For each variable, configure:

<AccordionGroup>
  <Accordion title="Basic properties">
    * **Name**: The variable key (e.g., `product_id`)
    * **Display Name**: Human-readable label
    * **Description**: What this variable represents
    * **Data Type**: String, Number, Boolean, Object, or Array
  </Accordion>

  <Accordion title="Validation rules">
    * **Required/Optional**: Whether the variable must be present
    * **Format**: Regex patterns for validation
    * **Allowed Values**: Specific values or ranges
    * **Default Value**: What to use if not provided
  </Accordion>

  <Accordion title="Advanced settings">
    * **Anonymize**: Mask sensitive data
    * **Transform**: Apply transformations before validation
    * **Custom Validation**: JavaScript validation functions
  </Accordion>
</AccordionGroup>

### Variable types and validation

<Tabs>
  <Tab title="String">
    ```javascript theme={null}
    {
      name: "product_category",
      type: "string",
      required: true,
      pattern: "^[a-z_]+$",
      maxLength: 50,
      allowedValues: ["electronics", "clothing", "home", "sports"]
    }
    ```
  </Tab>

  <Tab title="Number">
    ```javascript theme={null}
    {
      name: "price",
      type: "number",
      required: true,
      min: 0,
      max: 10000,
      decimalPlaces: 2
    }
    ```
  </Tab>

  <Tab title="Boolean">
    ```javascript theme={null}
    {
      name: "is_logged_in",
      type: "boolean",
      required: true,
      default: false
    }
    ```
  </Tab>

  <Tab title="Object">
    ```javascript theme={null}
    {
      name: "user",
      type: "object",
      required: false,
      properties: {
        id: { type: "string", required: true },
        type: { type: "string", enum: ["guest", "member", "premium"] }
      }
    }
    ```
  </Tab>
</Tabs>

## Organization features

### Event library

Build a reusable library of events:

<Steps>
  <Step title="Create library events">
    Define common events at the organization level
  </Step>

  <Step title="Set standards">
    Establish naming conventions and required variables
  </Step>

  <Step title="Import to projects">
    Use library events across multiple projects
  </Step>

  <Step title="Maintain Consistency">
    Updates to library events can cascade to projects
  </Step>
</Steps>

### Version control

Tag Insight automatically versions your tracking plans:

* **Auto-save**: Changes are saved automatically
* **Version History**: View and restore previous versions
* **Change Tracking**: See who made what changes when
* **Comparison**: Compare versions side-by-side

## Best practices

### Naming conventions

<AccordionGroup>
  <Accordion title="Event Names">
    * Use snake\_case: `product_view`, not `ProductView`
    * Be descriptive: `checkout_step_completed`, not `step`
    * Include context: `video_play_started`, not just `play`
  </Accordion>

  <Accordion title="Variable Names">
    * Consistent prefixes: `page_`, `user_`, `product_`
    * Clear purpose: `total_price_usd`, not `amount`
    * Avoid abbreviations: `quantity`, not `qty`
  </Accordion>
</AccordionGroup>

### Documentation

Always document:

* **When**: Exact conditions that trigger the event
* **Where**: Which pages or features fire the event
* **Why**: Business purpose of tracking this data
* **Examples**: Sample data layer outputs

### Progressive enhancement

<Steps>
  <Step title="Start Simple">
    Begin with critical business events only
  </Step>

  <Step title="Validate">
    Ensure basic tracking works perfectly
  </Step>

  <Step title="Expand Gradually">
    Add more detailed tracking over time
  </Step>

  <Step title="Review Regularly">
    Audit and clean up unused events quarterly
  </Step>
</Steps>

## Importing existing plans

### From Excel/CSV

<Steps>
  <Step title="Download Template">
    Get our Excel template from the import dialog
  </Step>

  <Step title="Fill Template">
    Add your events and variables following the format
  </Step>

  <Step title="Upload File">
    Drag and drop or browse to select your file
  </Step>

  <Step title="Map Columns">
    Match your columns to Tag Insight fields
  </Step>

  <Step title="Review and Import">
    Preview the import and confirm
  </Step>
</Steps>

### From other tools

Tag Insight supports importing from:

* Google Sheets
* Segment Protocols
* Adobe Data Layer Manager
* Custom JSON formats

<Info>
  Contact support for help migrating from other tracking plan tools.
</Info>

## Validation and testing

### Pre-implementation validation

Before implementing:

1. Review all events and variables
2. Check for naming consistency
3. Verify validation rules make sense
4. Test with sample data

### Post-implementation testing

After implementation:

1. Use the Chrome extension to capture real data
2. Compare against your tracking plan
3. Run test audits
4. Adjust validation rules as needed

## Common patterns

### E-commerce tracking plan

```javascript theme={null}
// Product Interactions
- product_viewed
- product_added_to_cart
- product_removed_from_cart

// Checkout Process
- checkout_started
- checkout_step_completed
- payment_info_entered

// Purchase
- purchase_completed
- order_confirmed

// Post-Purchase
- product_reviewed
- product_returned
```

### Content site tracking plan

```javascript theme={null}
// Content Engagement
- article_viewed
- article_read_progress
- article_shared
- comment_posted

// Navigation
- search_performed
- category_browsed
- tag_clicked

// User Actions
- newsletter_subscribed
- account_created
- preference_updated
```

## Next steps

<CardGroup cols={2}>
  <Card title="Import Methods" icon="file-import" href="/tracking-plans/import-methods">
    Learn about automated import options
  </Card>

  <Card title="Variable Configuration" icon="sliders" href="/tracking-plans/variable-configuration">
    Deep dive into variable setup and validation
  </Card>

  <Card title="Setting Up Audits" icon="magnifying-glass" href="/monitoring/setting-up-audits">
    Start monitoring your tracking plan
  </Card>

  <Card title="Best Practices" icon="star" href="/best-practices/tracking-plan-design">
    Learn tracking plan design best practices
  </Card>
</CardGroup>
