In-app survey inside web application

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

In-App Survey Implementation on Website

An in-app survey appears directly in the product interface in response to user action, not in a separate email. Conversion to response is higher than email surveys because the user is in the context of the interaction.

Survey System Architecture

Universal system: surveys are stored in a database with display conditions, the frontend engine decides whether to show them.

// Table schema
Schema::create('surveys', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->string('trigger_event');        // 'feature_used', 'upgrade_cancelled', 'idle_30_days'
    $table->json('trigger_conditions');     // {"min_sessions": 3, "plan": ["pro", "enterprise"]}
    $table->integer('delay_seconds')->default(0);
    $table->integer('cooldown_days')->default(30);
    $table->boolean('is_active')->default(true);
    $table->timestamps();
});

Schema::create('survey_questions', function (Blueprint $table) {
    $table->id();
    $table->foreignId('survey_id')->constrained()->cascadeOnDelete();
    $table->text('text');
    $table->enum('type', ['single_choice', 'multi_choice', 'text', 'scale', 'nps']);
    $table->json('options')->nullable();
    $table->integer('order')->default(0);
});

Schema::create('survey_responses', function (Blueprint $table) {
    $table->id();
    $table->foreignId('survey_id')->constrained();
    $table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
    $table->json('answers');                // {"q_1": "option_a", "q_2": "Great product"}
    $table->string('trigger_event')->nullable();
    $table->timestamps();
});

API: Retrieving Applicable Survey

class SurveyController extends Controller
{
    public function getForEvent(Request $request): JsonResponse
    {
        $event = $request->input('event');
        $user  = auth()->user();

        $survey = Survey::where('trigger_event', $event)
            ->where('is_active', true)
            ->get()
            ->first(function ($survey) use ($user) {
                // Check cooldown
                $lastResponse = SurveyResponse::where('survey_id', $survey->id)
                    ->where('user_id', $user->id)
                    ->latest()->first();

                if ($lastResponse && $lastResponse->created_at->diffInDays(now()) < $survey->cooldown_days) {
                    return false;
                }

                // Check conditions
                $conditions = $survey->trigger_conditions;
                if (isset($conditions['plan']) && !in_array($user->plan, $conditions['plan'])) {
                    return false;
                }

                return true;
            });

        if (!$survey) return response()->json(null);

        return response()->json([
            'id'        => $survey->id,
            'delay'     => $survey->delay_seconds,
            'questions' => $survey->questions()->orderBy('order')->get(),
        ]);
    }

    public function submit(Request $request, Survey $survey): JsonResponse
    {
        SurveyResponse::create([
            'survey_id'     => $survey->id,
            'user_id'       => auth()->id(),
            'answers'       => $request->input('answers'),
            'trigger_event' => $request->input('event'),
        ]);

        return response()->json(['success' => true]);
    }
}

Frontend: SurveyWidget

// hooks/useSurvey.ts
export function useSurvey(event: string) {
  const [survey, setSurvey] = useState<Survey | null>(null);

  const triggerEvent = useCallback(async () => {
    const data = await fetch(`/api/surveys/for-event?event=${event}`).then(r => r.json());
    if (!data) return;

    // Show with delay
    setTimeout(() => setSurvey(data), data.delay * 1000);
  }, [event]);

  return { survey, triggerEvent, dismiss: () => setSurvey(null) };
}

// Using in feature component
function FeatureComponent() {
  const { survey, triggerEvent, dismiss } = useSurvey('feature_export_used');

  useEffect(() => {
    // Trigger after successful export
    triggerEvent();
  }, []);

  return (
    <>
      <FeatureUI />
      {survey && <SurveyModal survey={survey} onClose={dismiss} />}
    </>
  );
}

SurveyModal with Dynamic Question Types

function SurveyModal({ survey, onClose }: SurveyModalProps) {
  const [answers, setAnswers] = useState<Record<string, any>>({});
  const [step, setStep]       = useState(0);

  const currentQuestion = survey.questions[step];
  const isLast          = step === survey.questions.length - 1;

  const submit = async () => {
    await fetch(`/api/surveys/${survey.id}/submit`, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ answers, event: survey.trigger_event }),
    });
    onClose();
  };

  return (
    <div className="fixed inset-0 bg-black/30 flex items-end sm:items-center justify-center p-4 z-50">
      <div className="bg-white rounded-xl p-6 w-full max-w-md shadow-2xl">
        <div className="flex justify-between mb-4">
          <span className="text-xs text-gray-400">{step + 1} / {survey.questions.length}</span>
          <button onClick={onClose} className="text-gray-400 hover:text-gray-600">✕</button>
        </div>

        <QuestionRenderer question={currentQuestion} value={answers[currentQuestion.id]}
          onChange={val => setAnswers(prev => ({ ...prev, [currentQuestion.id]: val }))} />

        <div className="flex justify-end mt-4">
          <button onClick={isLast ? submit : () => setStep(s => s + 1)}
            className="bg-blue-600 text-white px-4 py-2 rounded-lg text-sm">
            {isLast ? 'Submit' : 'Next'}
          </button>
        </div>
      </div>
    </div>
  );
}

Timeline

In-app survey system with dynamic conditions, response storage, and React widget: 4-6 business days.