Every host and framework

Set up Constile on Rails

Constile's gate runs in front of your pages. An AI agent fetching a page for a person gets an offer; people, search engines, and subscribers get your site as they do today.
Before you start
Sign up and add your site. Its page shows the site ID and secret these steps use, checks the install, and has Test my site. Rather have our team set it up with you? Select Get help installing on that page.
  1. Add the gem to your appDownload constile_gate-0.6.0.gem into your app's folder, then unpack it:
    gem unpack constile_gate-0.6.0.gem --target vendor/gems
    Add it to your Gemfile, run bundle install, and commit vendor/gems so your deploys get it too:
    gem "constile_gate", path: "vendor/gems/constile_gate-0.6.0"
    Ruby 2.7 or later.
  2. Add the gate (Rails does it for you)
    # Rails picks the gate up from the gem and puts it first in the
    # middleware stack. To check, run:
    bin/rails middleware
  3. Set your site's settingsSet these environment variables where your site runs. Keep the secret out of your code and your repository.
    CONSTILE_SITE_ID=your-site-id
    CONSTILE_SITE_SECRET=your-site-secret
    CONSTILE_NETWORK_URL=https://constile.app
    Your site's page shows its ID, and shows the secret once, when you add the site.
  4. Check the installDeploy, then select Check install on your site's page. The network asks your domain for /.well-known/constile, and the gate answers with your site secret. Then Test my site shows what a person, a search crawler, and an AI agent each get.
The full guide covers every option, proxies and load balancers, and caches.

Turn it off

Fastest, from your dashboard: once the gate is installed, select Pause offers under Manage on your site's page. The network stops making offers, and the gate passes every request through within a minute. Nothing changes on your server.On your site: Set CONSTILE_DISABLED=1 in the app's environment and restart it if your host sets the environment only at start. The gate reads it on every request. In Rails, config.constile_gate.enabled = false also turns it off.To take it out: Take the gate out, and the gem out of your Gemfile.Off or paused, people, search crawlers, subscribers, and your other ads get your site exactly as before.