Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cagov/benefits-recommender
A small, embeddable HTML widget that helps constituents find and apply for California State benefits.
https://github.com/cagov/benefits-recommender
Last synced: 11 days ago
JSON representation
A small, embeddable HTML widget that helps constituents find and apply for California State benefits.
- Host: GitHub
- URL: https://github.com/cagov/benefits-recommender
- Owner: cagov
- License: mit
- Created: 2023-10-17T22:02:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-21T17:55:55.000Z (5 months ago)
- Last Synced: 2024-11-20T17:47:26.485Z (2 months ago)
- Language: JavaScript
- Size: 485 KB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Benefits recommendation widget
The benefits recommender is a small, embeddable HTML widget. It helps constituents find and apply for California State benefits.
## How it works
Participating California State government departments can embed the benefits recommender widget on their web pages. On each visit, the widget performs the following actions.
1. First, the widget accepts information about the current visitor, such as preferred language.
2. Next, the widget communicates with our back-end server to determine the most relevant benefit application links to show to the visitor.
3. The widget then displays those benefit application links to the visitor.## How to use
Place the following HTML snippet wherever you want the widget to appear on your page.
```
```
That's it!
While the above snippet will work alone, we strongly recommend talking to us before use. We can tune our servers to ensure visitors to your site receive the most relevant benefit application links.
The widget accepts a few parameters for development purposes.
### Host
The optional `host` parameter tells the widget to pretend it's hosted on another page.
`host` should be supplied as a full URL.
When omitted, `host` will default to the current page.
But why would you want to use this? From our back-end API, we serve different links to the widget based upon where it's hosted. In development/staging environments, your page URLs may differ from the production URLs our back-end API expects. Therefore, the `host` parameter lets you "spoof" the widget's parent page. In non-production contexts, this can be helpful to correctly preview which links will be displayed by the widget.
```
```
### Language
The optional `language` parameter tells the widget which language is preferred.
`language` should be submitted as an [ISO 639-1 code](https://www.w3schools.com/tags/ref_language_codes.asp).
When omitted, `language` will default to the `lang` attribute of the `` element. (For example, ``.)
```
```
> Note: the widget's content is not yet translated to other languages. Until then, this parameter will have no effect. Stay tuned! Translations are coming soon.
### Endpoint
The optional `endpoint` parameter tells the widget which API to contact for links.
When omitted, `endpoint` will default to the production API.
This is probably only useful for the widget developers.
```
```
Here are the API endpoints for each environment.
| Environment | Endpoint URL |
| ------------------------ | ---------------------------------------- |
| Local API | http://localhost:3333 |
| Staging API | https://staging.br.api.innovation.ca.gov |
| Production API (default) | https://br.api.innovation.ca.gov |### Development
To make changes here, to the widget itself, run the following command to start a local development server from this repo. (NodeJS is required.)
```
npm run serve
```Then view the local test page URL.