# Configuration Guide

Configure your API keys and settings to connect the Itinerator plugin to the Tourismo platform.

## Accessing Settings

1. **Go to Itinerator Settings**
   - In your WordPress admin, click **Itinerator → Settings**
   - Or navigate to **Settings → Itinerator**

2. **Settings Overview**
   - The settings page contains all configuration options
   - Settings are organized into logical sections
   - Changes are saved automatically

## Required API Keys

### Platform API Key

**What it's for:** Connects to the main Tourismo platform to display content like itineraries, listings, events, and challenges.

**How to get it:**
1. Log into your [Tourismo admin account](https://admin.tourismo.co/)
2. Go to **Settings → API Keys**
3. Copy your Platform API key
4. Paste it into the WordPress plugin settings

**Verification:**
- The plugin will test the key automatically

### DMO Partner API Key (Optional)

**What it's for:** Displays itineraries that are related to a specific Destination Marketing Organization (DMO).

**How to get it:**
1. Contact your DMO partner representative
2. Request your DMO Partner API key
3. Add it to the plugin settings

**When to use:**
- Only needed if you're displaying DMO-itineraries
- Most users only need the Platform API key

### Google Maps API Key (Optional)

**What it's for:** Enables interactive maps in itinerary and map blocks.

**How to get it:**
1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Create a new project or select existing
3. Enable the Maps JavaScript API
4. Create credentials (API key)
5. Add it to the plugin settings

**Important:** Restrict the API key to your domain for security.

## Optional Settings

### Google Maps Map ID

**What it's for:** Customizes the appearance of Google Maps with your own styling.

**How to get it:**
1. In Google Cloud Console, go to **Maps → Map Management**
2. Create a new Map ID
3. Apply custom styling if desired
4. Copy the Map ID to the plugin settings

### Page Whitelist

**What it's for:** Limits plugin scripts to specific pages for performance.

**How to use:**
- Enter page IDs separated by commas
- Leave empty to load on all pages
- Useful for large sites with many pages

### Cache Settings

**What it's for:** Controls whether the api caching feature is active or not

### reCAPTCHA Protection

**What it's for:** Adds Google reCAPTCHA protection to forms to prevent spam submissions and bot attacks.

**How to configure:**
1. Go to [Google reCAPTCHA Console](https://www.google.com/recaptcha/admin)
2. Create a new site with reCAPTCHA v2 (checkbox)
3. Copy your Site Key and Secret Key
4. Add them to the plugin settings

**Settings:**
- **reCAPTCHA Site Key:** Your public site key from Google reCAPTCHA console
- **reCAPTCHA Secret Key:** Your private secret key (keep this secure)

**Features:**
- Automatically loads reCAPTCHA script when configured
- Can be enabled/disabled per form block
- Validates submissions server-side with Google
- Preserves form data if validation fails

**Note:** reCAPTCHA is only loaded when both keys are configured and enabled on a form.

### Powered by Tourismo Footer

**What it's for:** Controls the display of a "Powered by Tourismo" footer attribution on your site.

**Options:**
- **Disabled (No Footer):** No footer is displayed automatically (default)
- **Dark Theme:** Displays a dark footer with white text
- **Light Theme:** Displays a light footer with dark text

**Shortcode Usage:**
When disabled, you can use the shortcode to place a simple "Powered by Tourismo" link anywhere on your site:

- `[tourismo-powered-by color="auto"]` - Inherits text color from parent element, no logo background (default)
- `[tourismo-powered-by color="dark"]` - Dark text color with white logo background
- `[tourismo-powered-by color="light"]` - Light text color with white logo background
- `[tourismo-powered-by color="#ff0000"]` - Custom hex color with white logo background

**Examples:**
- Add to a page: `[tourismo-powered-by color="auto"]`
- Place in a widget: `[tourismo-powered-by color="dark"]`
- Custom color: `[tourismo-powered-by color="#0066cc"]`
- Embed anywhere: `<p>[tourismo-powered-by]. Bringing enchanting experiences and results to life</p>`

**Note:** The shortcode outputs a simple text link with a small logo. When using custom colors, the logo gets a white background with rounded corners for better visibility. The logo size automatically scales with your text (2em height).

## Testing Your Configuration

1. **Create a test page** with the block editor
2. **Add an Itinerator block** (any collection block)
3. **Check if content loads** without error messages

### Common Configuration Issues

**Platform API Key Invalid:**
- Check for extra spaces or characters
- Verify the key is copied completely
- Ensure your Tourismo account is active

**Google Maps Not Working:**
- Verify the API key is correct
- Check if Maps JavaScript API is enabled
- Ensure billing is set up in Google Cloud Console
- Check domain restrictions on the API key

**No Content Displaying:**
- Verify API keys are valid
- Check if content exists in your Tourismo admin
- Clear any caching plugins

## Security Best Practices

1. **Keep API keys private** - Don't share them publicly
2. **Use domain restrictions** - Limit Google Maps API key to your domain

## Next Steps

Once configuration is complete:

- **[Getting Started](getting-started.md)** - Create your first page
