Technical Integrations & Workflows

Running a long-term academic survey across multiple platforms requires reliable, automated plumbing. This page explains the three major platform integrations that keep TABS running: Qualtrics (the survey engine), Prolific (the participant recruitment platform), and Google Analytics (impact measurement). Each integration is managed through GitHub Actions workflows and TypeScript client libraries, so the entire operational lifecycle — from survey creation to data collection to analytics — is version-controlled and reproducible.

Integration Deep Dives

Each integration has a dedicated page with detailed methodology, architecture diagrams, and lessons learned:

Qualtrics — The Survey Engine

Qualtrics hosts the TABS survey instrument. The platform provides sophisticated logic capabilities, enterprise-grade security, and versatile data export. We interact with Qualtrics programmatically via its REST API v3, which enables us to copy surveys, inspect definitions, apply configuration changes, and export data — all from GitHub Actions.

API Integration Pattern

Every Qualtrics API call is authenticated with an X-API-TOKEN header. The token is stored as a GitHub Actions secret in the qualtrics-prod environment and is never committed to the repository. Workflows and scripts resolve the base URL and survey ID from environment variables, making it straightforward to point the automation at a different survey or datacenter.

Key environment values

  • QUALTRICS_BASE_URL — The datacenter root (e.g., https://yul1.qualtrics.com)
  • QUALTRICS_SURVEY_ID — The active survey ID (updated during annual rollover)
  • QUALTRICS_API_TOKEN — API authentication secret

Automated Workflows

Seven GitHub Actions workflows automate different aspects of Qualtrics management:

WorkflowPurposeRead / Write
qualtrics-api-smokeConnectivity & credential testRead-only
qualtrics-dump-flowExport Survey Flow JSON for inspectionRead-only
qualtrics-metrics-updateUpdate survey response metricsRead-only
fetch-qualtrics-questionsExtract survey questions & metadataRead-only
qualtrics-prolific-verifyVerify Prolific integration markersRead-only
qualtrics-copy-surveyCopy survey for annual rolloverWrite
qualtrics-prolific-applyApply Prolific integration configWrite

Annual Survey Rollover

TABS runs a 10-year data collection effort. Each year, a new copy of the survey is created so that yearly data stays cleanly separated. The recommended rollover sequence:

  1. Test connectivity — Run the smoke test workflow to verify credentials.
  2. Copy the survey — Use the copy workflow to clone the current survey.
  3. Update the environment variable — Point QUALTRICS_SURVEY_ID at the new survey ID.
  4. Verify configuration — Run the verification workflow against the new survey.
  5. Apply Prolific integration — If the copy didn't preserve Survey Flow branches, re-apply them.
  6. Update Prolific — Point the Prolific study's external URL at the new Qualtrics survey link.

Prolific — Participant Recruitment

Prolific specializes in high-quality academic research recruitment. It enables pre-screening participants by job seniority, industry sector, and other criteria — ensuring the survey reaches the right audience. The TABS integration uses Prolific's REST API v1 for automated weekly data collection.

How Prolific Connects to Qualtrics

When a Prolific participant starts the study, Prolific opens the Qualtrics survey URL and appends three URL parameters: PROLIFIC_PID, STUDY_ID, and SESSION_ID. Qualtrics captures these as Embedded Data fields, which allows us to link each survey response back to the Prolific submission.

At the end of the survey, the respondent is redirected to the appropriate destination based on the Survey Flow logic. Prolific participants are redirected to Prolific's completion page (with a completion code), while website visitors see a thank-you page on the TABS site.

Automated Data Collection

A GitHub Actions workflow (prolific.yml) runs every Monday at 9:00 AM UTC. It uses a TypeScript client library to query the Prolific API, collecting study metadata, submission statistics, and approval rates. The workflow can also be triggered manually for on-demand checks.

Survey Flow Architecture — The Two-Branch Design

The most critical piece of the Qualtrics–Prolific integration is the Survey Flow — the sequence of logic steps that Qualtrics executes for each respondent. The TABS survey uses a "redirect lockdown" pattern that ensures every respondent ends up at the correct destination, regardless of how they arrived at the survey.

Why We Need This

The survey accepts respondents from two channels. Website visitors click a button on technologyadoptionbarriers.org, which opens the Qualtrics survey with SOURCE=TABS_Website in the URL. Prolific participants are launched by Prolific, which appends PROLIFIC_PID, STUDY_ID, and SESSION_ID as URL parameters.

Without the lockdown, the redirect URL (COMPLETE_URL) could be passed as a URL parameter by anyone, creating an open-redirect vulnerability. The two-branch design hard-codes COMPLETE_URL inside the Survey Flow so that inbound URLs cannot override it.

The Two Branches

After all survey question blocks, the flow contains two conditional branches:

Branch 1 — If SOURCE is not empty

When the SOURCE field has any value (e.g., TABS_Website or prolific), the respondent came from a known channel. This branch sets COMPLETE_URL to the website completion page and ends the survey with a redirect.

Branch 2 — If PROLIFIC_PID is not empty

This is a safety net. If a Prolific participant arrives without SOURCE being set (e.g., due to a misconfigured study URL), the presence of PROLIFIC_PID alone is enough to tag them. This branch sets SOURCE="prolific", sets COMPLETE_URL to the Prolific completion URL, and ends the survey with a redirect to Prolific.

Branch 1 is evaluated first. Because Prolific links typically include SOURCE=prolific, Branch 1 catches Prolific participants and redirects them to the website completion page. This is intentional — the website thank-you page is appropriate for all respondents, and Prolific tracks completion independently via its authenticity script.

Visual Flow Diagram

┌─────────────────────────────────────────────┐
│  Top-Level Embedded Data                    │
│  ├─ PROLIFIC_PID   (captured from URL)      │
│  ├─ STUDY_ID       (captured from URL)      │
│  ├─ SESSION_ID     (captured from URL)      │
│  └─ SOURCE         (captured from URL)      │
└──────────────────┬──────────────────────────┘
                   │
                   ▼
┌─────────────────────────────────────────────┐
│  Survey Question Blocks (6 blocks)          │
│  (Demographics, barriers, adoption, etc.)   │
└──────────────────┬──────────────────────────┘
                   │
                   ▼
┌─────────────────────────────────────────────┐
│  Branch 1: If SOURCE is not empty           │
│  ├─ Set COMPLETE_URL = website URL          │
│  └─ End Survey → Redirect to website        │
└──────────────────┬──────────────────────────┘
                   │ (only reached if SOURCE
                   │  was empty)
                   ▼
┌─────────────────────────────────────────────┐
│  Branch 2: If PROLIFIC_PID is not empty     │
│  ├─ Set SOURCE = "prolific"                 │
│  ├─ Set COMPLETE_URL = Prolific URL         │
│  └─ End Survey → Redirect to Prolific       │
└─────────────────────────────────────────────┘

The Apply Script

The branches are managed by a TypeScript script (scripts/qualtrics-apply-prolific-integration.ts) that reads the current Survey Flow, removes any existing TABS branches, rebuilds the two branches with hard-coded URLs, and writes the flow back via the Qualtrics API. The script is idempotent — running it multiple times produces the same result.

A companion workflow (qualtrics-prolific-apply.yml) runs this script in GitHub Actions with a safety gate: you must type APPLY to confirm you want to modify the live survey.

Inspecting the Live Flow

A read-only workflow (qualtrics-dump-flow.yml) exports the current Survey Flow JSON. The output is printed to the workflow log and uploaded as a downloadable artifact. This is useful for verifying that the apply script produced the expected result, or for debugging API issues.

Google Analytics — Impact Measurement

Google Analytics 4 (GA4) tracks how researchers, participants, and the public interact with the TABS website. A daily GitHub Actions workflow fetches analytics data via the Google Analytics Data API, generates a JSON report, and emails a summary to stakeholders.

Automated Reporting

The daily report workflow (ga-report.yml) uses a service account to authenticate with the GA4 API. It collects metrics like active users, sessions, engagement rate, and top pages, then saves the data to src/data/impact.json for display on the website. A companion script emails the report to the project team.

Verified Visitors Methodology

Raw GA4 numbers can be misleading — 99.6% of recorded traffic came from localhost (Playwright tests, CI runs, AI agents). The "Verified Visitors" metric filters to the production hostname only, showing actual human visitors.

Read the full methodology

GitHub Actions — The Automation Layer

GitHub Actions ties everything together. Every integration workflow runs in a secure, isolated environment with access to the API credentials it needs. Workflows are triggered on a schedule, manually via the GitHub UI or CLI, or automatically by events like pushes and pull requests.

Environments & Secrets

API tokens are stored as GitHub Actions environment secrets — encrypted at rest and never exposed in logs. Each external service has its own environment:

EnvironmentServiceWorkflows
qualtrics-prodQualtrics API7 workflows
prolific-prodProlific API2 workflows
google-prodGoogle Analytics1 workflow

CI/CD Pipeline

Beyond API integrations, GitHub Actions runs the full CI/CD pipeline on every pull request: formatting checks, linting, unit tests (including accessibility tests with jest-axe), static site build, and Playwright end-to-end tests. The site deploys automatically to GitHub Pages when changes merge to the main branch.

For Developers & Contributors

Detailed documentation for each integration is maintained alongside the codebase:

  • Prolific Integration Guide — Complete setup, Survey Flow architecture, verification, and annual rollover (PROLIFIC_INTEGRATION.md)
  • Qualtrics API Cheat Sheet — Quick reference for common API calls, including tenant-specific field values (qualtrics-api-cheatsheet.md)
  • API Integration Guide — Comprehensive reference for all three APIs, environments, secrets, and workflows (API_INTEGRATION_GUIDE.md)
  • MCP Servers — Model Context Protocol integration for AI coding agents (MCP_SERVERS.md)

All documentation is in the repository root. The source code for client libraries lives in src/lib/, and workflow files are in .github/workflows/.

This page is a living document, updated as integrations evolve. For the most current details, refer to the documentation files linked above in the project repository.