Region Link Automated Filtering

Automated Provider Search Filtering via URL & Cookies

This snippet automatically pre-filters Prisma Health provider search links based on visitor location β€” either from ad campaign parameters or saved zip code cookies.

Coverage

The system currently supports automated targeting for the following markets:

South Carolina

  • Midlands: Columbia, Lexington, Sumter, Orangeburg
  • Upstate: Greenville, Spartanburg, Anderson

Tennessee

  • Metros: Nashville, Knoxville, Chattanooga
  • East TN: Maryville, Alcoa, Louisville, Vonore

Quick Start

Add the script to any page before the closing </body> tag. No dependencies required.

<script src="https://lp.prismahealth.org/global/prisma-health/prisma-region-links.js"></script>

Configuration

Settings are managed within the CONFIG block at the top of the file:

const CONFIG = {
  mode: "auto",              // 'auto' or 'opt-in'
  deploymentMode: "testing", // 'testing' (requires ?prisma_debug=1) or 'live' (runs for everyone)
  regionParam: "region",     // Page-level URL parameter name
  zipParam: "zip",           // Page-level URL parameter name
  distanceParam: "distance", // Page-level URL parameter name
  optInParam: "dynamic-region", // Per-link URL parameter for opt-in mode
  zipCookieName: "zipCode",  // Site cookie name
  regionCookieName: "prisma_region", // Cookie to persist region param
  regionCookieDurationHours: 2,      // Duration for region cookie
  zipRegionCookieName: "prisma_zip", // Cookie to persist zip param
  zipRegionCookieDurationHours: 2,   // Duration for zip cookie
  distanceCookieName: "prisma_distance", // Cookie to persist distance param
  distanceCookieDurationHours: 2,    // Duration for distance cookie
  defaultDistance: "15",     // Default distance in miles
  debugParam: "prisma_debug" // Activates debug mode
};

Operation Modes

Auto Mode (Default)

Every link targeting PRISMA_SEARCH_DOMAINS is updated automatically, unless the URL contains locations.name or locations.id (to preserve pre-filtered location results).

Opt-In Mode

Only links explicitly flagged are modified. You can flag a link using either a data attribute OR a URL parameter (ideal for CMS admins who can only edit link destinations):

Method 1: URL Parameter (Recommended for CMS)

<a href="https://prismahealth.org/search?dynamic-region=1">
  Find a Doctor
</a>

Method 2: Data Attribute

<a href="https://prismahealth.org/search" data-prisma-region-link>
  Find a Doctor
</a>
Tip: If using the URL parameter method, the Script will automatically remove the ?dynamic-region=1 parameter before redirecting the user, ensuring the final search URL remains clean.

Debug & Testing

Activate Debug Mode by adding ?prisma_debug=1 to your URL. This enables a visible overlay in the bottom-right corner to verify link changes and location sources.

Note: Debug mode sets a 30-day cookie (prisma_debug_mode=1). You will remain in debug mode until you click "Exit Debug" in the panel or manually clear your cookies.

Debug Panel Features

  • Click to Scroll: Click any "LINK X" card to scroll to and highlight the modified link on the page.
  • Clear Cookie: If a region cookie is active, use the "Clear Cookie" button to remove it and test fallback scenarios.
  • Exit Debug: Removes the debug cookie and reloads the page.

Example Test URLs

  • Specific Region: .../?prisma_debug=1&region=columbia (Sets 2-hour region cookie)
  • Specific Zip: .../?prisma_debug=1&zip=29201&distance=25 (Sets 2-hour zip and distance cookies)
  • Cookie Test: .../?prisma_debug=1 (Uses existing region or zip cookies)

Region & Zip Mapping

The REGION_MAP connects campaign keys to specific search coordinates.

Field Description Example
location Lat/Long coordinates "34.00,-81.03"
display_location Human-readable label "Columbia, SC"
Tip: Organize new zip codes in the ZIP_MAP under comment headers to keep the file maintainable as the network grows.

Priority Logic

Location is resolved in the following order of operations:

  • Zip Parameter: Campaign links (e.g., ?zip=) always take highest precedence. The value is saved to a 2-hour cookie.
  • Zip Param Cookie: If no Zip parameter is present, the script checks for a recently saved prisma_zip cookie.
  • Region Parameter: Campaign links (e.g., ?region=) take precedence if no zip is provided. The value is saved to a 2-hour cookie.
  • Region Cookie: If no Region parameter is present, the script checks for a recently saved prisma_region cookie.
  • Site Zip Cookie: Uses the visitor's overall saved site preferences (zipCode) if no ad/campaign data is found.
  • Fallback: If none of the above are found, links remain in their original state.