Liquid Variables
Add the following to config/settings_schema.json
{
"name": {
"en": "Beam"
},
"settings": [
{
"label": {
"en": "API Key"
},
"type": "text",
"id": "beam_api_key"
},
{
"label": {
"en": "SDK Version"
},
"type": "text",
"id": "beam_sdk_version"
},
{
"label": {
"en": "Base URL"
},
"type": "text",
"id": "beam_base_url"
},
{
"label": {
"en": "Statsig API Key"
},
"type": "text",
"id": "beam_statsig_api_key"
},
{
"label": {
"en": "Store Domain"
},
"type": "text",
"id": "beam_store_domain"
},
{
"label": {
"en": "Chain ID"
},
"type": "number",
"id": "beam_chain_id"
},
{
"label": {
"en": "Store ID"
},
"type": "number",
"id": "beam_store_id"
}
]
},
The config/settings_data.json
should then reflect the values:
"beam_api_key": "beamtest-eqbm7NyrAslP.94a8a48a-ca89-45df-b4c8-2d0e2c486bf9",
"beam_sdk_version": "v1.31.0",
"beam_base_url": "https:\/\/staging-central-backend.beamimpact.com",
"beam_statsig_api_key": "client-oe3JzxuVxvdKjXiZcaJfLweQlFa9BhcA1l5OdhJUEtU",
"beam_chain_id": 55,
"beam_store_id": 80,
The variables can be used in Liquid templating:
{{ settings.beam_api_key }}
{{ settings.beam_sdk_version }}
{{ settings.beam_base_url }}
{{ settings.beam_statsig_api_key }}
{{ settings.beam_store_domain }}
{{ settings.beam_chain_id }}
{{ settings.beam_store_id }}
<script type="module">
import { init } from "https://sdk.beamimpact.com/web-sdk/{{ settings.beam_sdk_version }}/dist/integrations/beam.js"
import { StatsigPlugin } from "https://sdk.beamimpact.com/web-sdk/{{ settings.beam_sdk_version }}/dist/integrations/statsig.js"
const beam = await init({
apiKey: "{{ settings.beam_api_key }}", // i.e., "abc123.xyz456"
chainId: {{ settings.beam_chain_id }}, // i.e., 1000
storeId: {{ settings.beam_store_id }}, // i.e., 50000
domain: "{{ settings.beam_store_domain }}", // i.e., "pets.com"
// Base URL is optional - it is used to change to a staging server
baseUrl: "{{ settings.beam_base_url }}",
plugins: [
new StatsigPlugin({ statsigApiKey: "{{ settings.beam_statsig_api_key }}" })
], // Beam Plugins, such as Statsig (see documentation)
});
</script>
You should be able to edit the values without opening the code by going to Theme > Customize on the themes page.