Know exactly how your customers found you. Shop-Sense drops a lightweight "How did you hear about us?" survey into your Shopify storefront and turns the answers into a clean, Polaris-powered analytics dashboard.
Attribution is one of the hardest things for a store owner to measure. Ad platforms take credit, referrals go untracked, and "word of mouth" is invisible. Shop-Sense asks the customer directly β right at checkout β and stores every answer so you can see which channels actually drive sales.
- π One-tap survey injected into your storefront cart/checkout β no theme rebuild required.
- π― Source attribution (Social Media Β· Search Engine Β· Friend Β· Other) captured per response.
- π Merchant dashboard built with Shopify Polaris for a native admin look and feel.
- π§± Clean REST API you can extend with new questions, product data, or exports.
- π³ Dockerized backend for one-command deployment anywhere.
Shopify Storefront Frontend (Next.js) Backend (Express + MongoDB)
ββββββββββββββββββββββ ββββββββββββββββββββββ ββββββββββββββββββββββββββββ
β inject-survey.js β β / Home β β GET /api/products β
β "How did you hear βββPOSTβββββΆβ /dashboard Admin ββββββββΆ β POST /api/survey/submit β
β about us?" β β Polaris UI + proxyβ β GET /api/survey/... β
ββββββββββββββββββββββ ββββββββββββββββββββββ β β© Mongoose β
β MongoDB Atlas β
ββββββββββββββββββββββββββββ
| Layer | Stack | Location |
|---|---|---|
| Storefront widget | Vanilla JS injected into the cart | backend/scripts/inject-survey.js |
| Backend API | Node.js Β· Express (ESM) Β· Mongoose | backend/ |
| Frontend | Next.js 15 Β· React 18 Β· Shopify Polaris Β· Tailwind CSS | frontend/ |
| Admin dashboard | Polaris IndexTable |
frontend/pages/dashboard.js |
- Node.js 18+
- A MongoDB connection string (local or MongoDB Atlas)
git clone https://github.com/topshopifydev/Shopify-Survey-App.git
cd Shopify-Survey-App
# Backend
cd backend && npm install
# Frontend
cd ../frontend && npm installCreate backend/.env:
MONGO_URI=mongodb+srv://<user>:<password>@<cluster>/shop-sense
PORT=5000# Terminal 1 β API on http://localhost:5000
cd backend && npm run dev
# Terminal 2 β Web app on http://localhost:3000
cd frontend && npm run devThe frontend proxies /api/* to the backend automatically (see frontend/next.config.js), so no CORS wrangling in dev.
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/products |
Returns the demo product catalog |
POST |
/api/survey/submit |
Saves a survey response β body: { "source": "social_media" } |
GET |
/api/survey/responses |
Returns all collected survey responses |
GET |
/ |
Health check |
Example β submit a response:
curl -X POST http://localhost:5000/api/survey/submit \
-H "Content-Type: application/json" \
-d '{"source":"search_engine"}'Include inject-survey.js in your theme (or via a script tag / theme app extension). It looks for a .cart element, appends the survey form, and posts answers to /api/survey/submit β no duplicate forms, with inline success/error messaging.
cd backend
docker build -t shop-sense-backend .
docker run -p 5000:5000 --env-file .env shop-sense-backendShopify-Survey-App/
βββ backend/
β βββ server.js # Express app + products API
β βββ routes/survey.js # Survey submit / responses endpoints
β βββ models/SurveyResponse.js# Mongoose schema
β βββ config/db.js # MongoDB connection
β βββ scripts/inject-survey.js# Storefront survey widget
β βββ Dockerfile
βββ frontend/
βββ pages/
β βββ index.js # Home + product list
β βββ dashboard.js # Polaris survey dashboard
βββ components/ # SurveyForm Β· ProductList Β· DataTable
βββ next.config.js # API proxy config
- Wire survey routes + MongoDB into
server.jsstartup - Configurable, multi-question surveys
- CSV / analytics export from the dashboard
- Official Shopify theme app extension
- Response charts & channel breakdown
Contributions are welcome! Open an issue to discuss a feature, or fork the repo and submit a pull request. If Shop-Sense helps you, please β star the repo β it genuinely helps others discover it.
Released under the MIT License.