Skip to content

Instantly share code, notes, and snippets.

@araphiel
Last active March 15, 2021 04:13
Show Gist options
  • Save araphiel/badc4c90ccae0adfd6ae21916e80c827 to your computer and use it in GitHub Desktop.
Save araphiel/badc4c90ccae0adfd6ae21916e80c827 to your computer and use it in GitHub Desktop.
Example Brand Bot Setup
<!-- Begin BrandBot Signup Form -->
<!-- <link href="https://assets.brandbot.com/forms/embed/embed.css" rel="stylesheet" type="text/css" /> -->
<div id="bb_form">
<form
method="post"
action="https://microservices.brndbot.net/forms/answers"
name="{formId}"
id="bb_form_inner"
>
<div id="alert"></div>
<div class="form-group">
<label for="bb_first_name">First Name</label>
<input
type="text"
name="bb_first_name"
id="bb_first_name"
class="form-control"
required="required"
placeholder="First Name"
/>
</div>
<div class="form-group">
<label for="bb_last_name">Last Name</label>
<input
type="text"
name="bb_last_name"
id="bb_last_name"
class="form-control"
required="required"
placeholder="Last Name"
/>
</div>
<div class="form-group">
<label for="bb_email">Email Address</label>
<input
type="email"
name="bb_email"
id="bb_email"
class="form-control"
required="required"
placeholder="Email Address"
/>
</div>
<div class="form-group">
<label for="bb_phone">Phone Number</label>
<input
type="tel"
name="bb_phone"
id="bb_phone"
class="form-control"
required="required"
placeholder="Phone Number"
/>
</div>
<div class="form-group">
<!-- Custom hidden fields -->
<input
type="hidden"
name="bb_custom_utm-source"
id="bb_custom_utm-source"
value="utm_source"
/>
<input
type="hidden"
name="bb_custom_utm-medium"
id="bb_custom_utm-medium"
value="utm_medium"
/>
<input
type="hidden"
name="bb_custom_utm-campaign"
id="bb_custom_utm-campaign"
value="utm_campaign"
/>
</div>
<div class="form-group">
<input
type="hidden"
name="bb_uuid"
id="bb_uuid"
value="db6c41ed-3913-49df-a741-400f29434589"
/>
<button
type="submit"
class="btn"
id="bb_submit"
>
Submit
</button>
</div>
</form>
</div>
<script src="https://assets.brandbot.com/forms/embed/embed.js?id={formID}"></script>
<!-- Ending BrandBot Signup Form -->
<script>
document.addEventListener('DOMContentLoaded', handleBrandBotForm)
function handleBrandBotForm () {
if (!window.location.search) return
const params = new URLSearchParams(window.location.search)
const source = params.get('utm_source'),
medium = params.get('utm_medium'),
campaign = params.get('utm_campaign')
document.getElementById('bb_custom_utm-source').value = source
document.getElementById('bb_custom_utm-medium').value = medium
document.getElementById('bb_custom_utm-campaign').value = campaign
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment