Advanced Embed Options
The Publish tab writes the embed snippet for you. This page explains the settings in that snippet and a few extra ones for custom setups.
Detail URL template
Section titled “Detail URL template”By default, clicking a record opens its details inside the embed. To send visitors to pages on your own site instead, set a detail URL template.
From the dashboard: On the Publish tab, open Detail page URL (optional), enter a URL in Custom detail URL template (for embed), and click Save template. This option appears when detail pages are on. The saved template is used by embeds of this project.
In the snippet: Add detailUrlTemplate. This overrides the saved template for that embed.
window.FieldFlow.q.push({ projectId: "...", apiKey: "...", container: "#fieldflow-directory-1a2b3c4d", apiBaseUrl: "https://getfieldflow.io", detailUrlTemplate: "https://mysite.com/resources/{{externalId}}"});{{externalId}} is replaced with the record’s sheet row, for example row_7 for the record on row 7 of your sheet. The page opens in a new browser tab.
Open a specific record on load
Section titled “Open a specific record on load”Use openRecordId to load a directory embed with one record’s details already open:
window.FieldFlow.q.push({ projectId: "...", apiKey: "...", container: "#fieldflow-directory-1a2b3c4d", apiBaseUrl: "https://getfieldflow.io", openRecordId: "record-id-here"});This is useful when a page on your site should show one specific resource.
To find a record’s ID, open the record on your hosted directory. The ID is the last part of its address: https://getfieldflow.io/p/[projectId]/[recordId]. Older record IDs still work.
Links to a record inside an embed
Section titled “Links to a record inside an embed”When a visitor opens a record in a directory embed, the page address gets a #record/... ending. Anyone who opens that address sees the embed with the record already open. You don’t need to set anything up for this.
Pre-filtering
Section titled “Pre-filtering”To load the directory with some categories already selected, use Start with filters on the Publish tab. It adds a preFilter setting to the snippet:
options: { preFilter: { taxonomyId: "taxonomy-id", slugs: ["housing", "food"] }}Let the Publish tab write this for you, so the IDs are correct.
Quiz redirect
Section titled “Quiz redirect”In Quiz only mode, the snippet includes an onComplete function. It runs when the visitor finishes the quiz and sends them to your redirect path with their answers added to the URL:
onComplete: function(filters, queryString) { window.location = "/resources" + (queryString ? "?" + queryString : "");}You can also build the URL with FieldFlow.buildFilterUrl("/resources", filters).
Set theme to "light", "dark", or "system". "system" follows the visitor’s device. If you leave theme out, the embed is light. The Publish tab always adds this line for you.
Language
Section titled “Language”Set lang to a language code to start the embed in that language:
window.FieldFlow.q.push({ projectId: "...", apiKey: "...", container: "#fieldflow-directory-1a2b3c4d", lang: "es", languageSwitcher: true, apiBaseUrl: "https://getfieldflow.io",});- Leave
langout to match your web page’s language (thelangattribute on your page’s<html>tag) - A language your directory doesn’t offer shows in English
- When
langis set, visitors don’t get a language menu unless you addlanguageSwitcher: true(directory embeds only)
The Publish tab writes these lines for you when you pick a Language. See Languages Overview.
Embed modes
Section titled “Embed modes”| Mode | Value | Description |
|---|---|---|
| Directory only | "directory" |
Directory with search and filters (default) |
| Quiz only | "quiz" |
Quiz, then redirect to your page. Needs onComplete |
| Quiz + directory | "quiz+directory" |
Quiz first, then results in the same embed |
All configuration options
Section titled “All configuration options”| Option | Type | Default | Description |
|---|---|---|---|
projectId |
string | required | Your project ID |
apiKey |
string | required | API key from the Publish tab |
container |
string | required | CSS selector for the element to render into |
apiBaseUrl |
string | None | https://getfieldflow.io. Keep the value from your snippet |
mode |
string | "directory" |
"directory", "quiz", or "quiz+directory" |
theme |
string | "light" |
"light", "dark", or "system" |
lang |
string | matches the page | A language code, such as "en" or "es" |
languageSwitcher |
boolean | false |
Show the language menu when lang is set (directory mode) |
detailUrlTemplate |
string | None | Your own URL for detail pages |
openRecordId |
string | None | Open this record’s details on load (directory mode) |
onComplete |
function | None | Quiz only: called when the quiz finishes |
options.preFilter |
object | None | Categories to pre-select |
Options from older snippets, such as showSearch, showFilters, and itemsPerPage, are no longer used. You can leave them in or remove them.