Skip to content

citecue/prestashop-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

CiteCue AI Delivery for PrestaShop

A PrestaShop module that acts as a middleware (proxy) between AI bots/crawlers and your shop: requests from known AI user agents (GPTBot, ClaudeBot, ChatGPT-User, PerplexityBot, …) receive the CiteCue AI-enhanced version of your pages and products, generated by the CiteCue app Auto-Fix pipeline. Regular visitors always get the normal PrestaShop pages.

How it works

AI crawler ──▶ PrestaShop front controller
                 │  actionDispatcherBefore (this module, earliest front-office hook)
                 │
                 ├─ User-Agent matches the CiteCue crawler registry?
                 │    no  ──▶ normal PrestaShop rendering
                 │    yes ──▶ GET {api}/api/delivery/v2/page?k=…&u=…&b=…
                 │              Authorization: Bearer ck_live_…
                 │              X-Citecue-Channel: prestashop
                 │              If-None-Match: <cached ETag>
                 │
                 │         200 ──▶ serve enhanced HTML, stop
                 │         304 ──▶ serve locally cached body, stop
                 │         404 ──▶ not optimized: cache miss 60 s, normal rendering
                 │         timeout/error ──▶ fail open, normal rendering
  • Serving + analytics in one call — the v2 delivery endpoint records the crawler hit (served/passthrough, channel, crawler id) server-side, so the Agent Traffic dashboard in CiteCue fills up with no extra beacon.
  • ETag revalidation — enhanced bodies are cached locally; repeat crawler hits cost one cheap conditional request (a 304 still counts as served).
  • Miss negative-cache (60 s) — pages without an enhanced version don't trigger an API call for every crawler request.
  • Fail open, always — any API error, timeout or unexpected exception degrades to normal PrestaShop rendering. Human traffic never waits on the CiteCue API: the crawler-registry refresh only runs on requests that already matched a crawler.
  • Crawler registry auto-refresh — a snapshot of the CiteCue crawler registry ships with the module and is refreshed every 6 h from the keyless GET /api/delivery/v1/crawlers feed, so new crawlers are detected without a module update.
  • /llms.txt — served from GET /api/delivery/v2/llms.txt (to every visitor, cached 5 min), when enabled both in the module and for the project in the CiteCue dashboard.
  • No Host-header forwarding — the URL sent to the API is built from the shop's configured domain, so a spoofed Host header can't be replayed.

Installation

  1. Zip the module folder: cd citecue-prestashop && zip -r citecue.zip citecue (or copy citecue/ into your shop's modules/ directory).
  2. In the back office: Modules → Module Manager → Upload a module.
  3. Open the module configuration:
    • paste your organization API key (ck_live_…) from the CiteCue dashboard (Settings → API keys);
    • the module auto-selects the CiteCue project matching your shop's domain (override the public key manually if needed);
    • flip Serve enhanced pages to AI crawlers to Yes.
  4. In the CiteCue dashboard, register/approve pages on the Auto-Fix page and make sure delivery is enabled for the project.

The configuration page performs a live connection test on every load and tells you if the key is invalid, no project matches the shop domain, or delivery is switched off dashboard-side.

Verify from a shell:

curl -A "GPTBot" -sI https://your-shop.example/some-optimized-page/
# → X-Served-By: citecue-prestashop + X-Citecue-Mode on optimized pages
curl -s https://your-shop.example/llms.txt

Requirements

  • PrestaShop 1.7.1+ (including 8.x / 9.x) — the actionDispatcherBefore hook the module relies on was introduced in 1.7.1.0
  • Outbound HTTPS from the shop server to the CiteCue API (default https://app.citecue.com; configurable for self-hosted instances)
  • PHP cURL extension recommended (a stream fallback is included)

Module layout

citecue/
├── citecue.php                  # module: hooks, config page, serving logic
├── classes/
│   ├── CitecueClient.php        # HTTP client for the Delivery API (v2 + v1 registry)
│   ├── CitecueCrawlers.php      # bundled + auto-refreshed crawler UA registry
│   └── CitecueCache.php         # file cache: ETag bodies + negative misses
└── logo.png

Notes

  • The module sends X-Citecue-Channel: prestashop. Until the CiteCue API adds prestashop to its channel enum, hits are bucketed under the fallback channel (wordpress) in the Agent Traffic channel split — everything else (crawler ids, served/passthrough) is exact.
  • Cached bodies live in var/cache/…/citecue/ (_PS_CACHE_DIR_) and are cleared on settings change and uninstall.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages