Skip to content

Instantly share code, notes, and snippets.

@jentanbernardus
Created June 26, 2016 00:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jentanbernardus/46004c33ce0c836699d6c9879e8dd090 to your computer and use it in GitHub Desktop.
Save jentanbernardus/46004c33ce0c836699d6c9879e8dd090 to your computer and use it in GitHub Desktop.
Helpscout Beacons

Javascript API

The Javascript API exposes the following methods to the global object HS.beacon. You can use them to control your Beacon programmatically, both in modal and popover mode.

.ready( )    
.open( )    
.close( )    
.toggle( )    
.identify( )    
.search( )    
.suggest( )    
.reset( )    
.init( )     
.destroy( )     
<!--
# Customization
Beacons can be customized and manipulated in a number of ways.
All customizations are applied before the initial rendering and can only happen once during the page lifecycle.
To interact with the Beacon after it has been rendered, please refer to the Javascript API documentation.
@link http://developer.helpscout.net/beacons/customization/
-->
<script>
HS.beacon.config({
modal: true,
color: '#cacaca',
icon: 'search',
translation: {
messageLabel: 'What can I help you with?'
searchLabel: 'En que podemos ayudarte?',
searchErrorLabel: 'Lo sentimos, hubo un error con tu busqueda'
},
topics: [
{ val: 'need-help', label: 'Need help with the product' },
{ val: 'bug', label: 'I think I found a bug'}
],
attachment: false,
poweredBy: false,
instructions:'This is instructional text that goes above the form.'
});
</script>
// Un-minified
!function (e, o, n) {
window.HSCW = o, window.HS = n, n.beacon = n.beacon || {};
var t = n.beacon;
t.userConfig = {}, t.readyQueue = [], t.config = function (e) {
this.userConfig = e
}, t.ready = function (e) {
this.readyQueue.push(e)
}, o.config = {
docs: {enabled: !1, baseUrl: ""},
contact: {enabled: !0, formId: "XXXXX-XXXXX-XXX-XXXX"}
};
var r = e.getElementsByTagName("script")[0], c = e.createElement("script");
c.type = "text/javascript", c.async = !0, c.src = "https://djtflbt20bdde.cloudfront.net/", r.parentNode.insertBefore(c, r)
}(document, window.HSCW || {}, window.HS || {});
// Minified
!function(e,o,n){window.HSCW=o,window.HS=n,n.beacon=n.beacon||{};var t=n.beacon;t.userConfig={},t.readyQueue=[],t.config=function(e){this.userConfig=e},t.ready=function(e){this.readyQueue.push(e)},o.config={docs:{enabled:!1,baseUrl:""},contact:{enabled:!0,formId:"XXXXX-XXXXX-XXX-XXXX"}};var r=e.getElementsByTagName("script")[0],c=e.createElement("script");c.type="text/javascript",c.async=!0,c.src="https://djtflbt20bdde.cloudfront.net/",r.parentNode.insertBefore(c,r)}(document,window.HSCW||{},window.HS||{});
<!--# Generated by https://wordpress.org/plugins/beacon-for-helpscout-->
<!--# Config-->
<script type='text/javascript'>
/* <![CDATA[ */
var beacon_vars = {"modal":"","enable_docs":"","enable_contact":"1","subdomain":"","form_id":"5c2a213d-9b61-11e5-9e75-0a7d6919297d","default_color":"#dd3333","icon":"bouy","top_articles":"","attachment":"1","powered_by":"1","instructions":"","search_label":"What can we help you with?","search_error_label":"Your search timed out. Please double-check your internet connection and try again.","no_results_label":"No results found for","contact_label":"Send a Message","attach_file_label":"Attach a file","attach_file_error":"The maximum file size is 10mb","name_label":"Your Name","name_error":"Please enter your name","email_label":"Email address","email_error":"Please enter a valid email address","subject_label":"Subject","subject_error":"Please enter a subject","message_label":"How can we help you?","message_error":"Please enter a message","success_label":"Message sent!","success_desc":"Thanks for reaching out! Someone from our team will get back to you soon."};
/* ]]> */
</script>
<!--# Beacon.min.js-->
jQuery(document).ready(function(e){"use strict";!function(e,a,c){window.HSCW=a,window.HS=c,c.beacon=c.beacon||{};var o=c.beacon;o.userConfig={},o.readyQueue=[],o.config=function(e){this.userConfig=e},o.ready=function(e){this.readyQueue.push(e)},a.config={docs:{enabled:beacon_vars.enable_docs,baseUrl:"https://"+beacon_vars.subdomain+".helpscoutdocs.com/"},contact:{enabled:beacon_vars.enable_contact,formId:beacon_vars.form_id}};var r=e.getElementsByTagName("script")[0],n=e.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://djtflbt20bdde.cloudfront.net/",r.parentNode.insertBefore(n,r)}(document,window.HSCW||{},window.HS||{}),HS.beacon.config({modal:beacon_vars.modal,poweredBy:beacon_vars.powered_by,color:beacon_vars.default_color,icon:beacon_vars.icon,topArticles:beacon_vars.top_articles,attachment:beacon_vars.attachment,instructions:beacon_vars.instructions,translation:{searchLabel:beacon_vars.search_label,searchErrorLabel:beacon_vars.search_error_label,noResultsLabel:beacon_vars.no_results_label,contactLabel:beacon_vars.contact_label,attachFileLabel:beacon_vars.attach_file_label,attachFileError:beacon_vars.attach_file_error,nameLabel:beacon_vars.name_label,nameError:beacon_vars.name_error,emailLabel:beacon_vars.email_label,emailError:beacon_vars.email_error,subjectLabel:beacon_vars.subject_label,subjectError:beacon_vars.subject_error,messageLabel:beacon_vars.message_label,messageError:beacon_vars.message_error,contactSuccessLabel:beacon_vars.success_label,contactSuccessDescription:beacon_vars.success_desc}}),1==beacon_vars.modal&&(HS.beacon.ready(function(){}),e(".show-beacon.menu-item a").click(function(e){e.preventDefault(),HS.beacon.open()}),e(".show-beacon").click(function(e){e.preventDefault(),HS.beacon.open()}))});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment