Skip to content

Instantly share code, notes, and snippets.

@swoboda
Created September 12, 2016 13:36
Show Gist options
  • Save swoboda/9331b1d939a1cbb56167c1159654caae to your computer and use it in GitHub Desktop.
Save swoboda/9331b1d939a1cbb56167c1159654caae to your computer and use it in GitHub Desktop.
hs_beacon_problem
<?php
add_action('in_admin_footer', 'my_admin_footer_function');
/**
* Add HS Beacon
*
*/
function my_admin_footer_function() {
$current_url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$user = wp_get_current_user();
//var_dump($user );
?>
<script>!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:"c66d6d0b-78e5-11e6-91aa-0a5fecc78a4d"}};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||{});</script>
<script>
HS.beacon.config({
modal: false,
color: '#039047',
//icon: 'question',
//topics: [
// { val: 'need-help', label: 'Need help with the product' },
// { val: 'bug', label: 'I think I found a bug'}
//],
<?php
if ( get_locale() === 'pl_PL' ) {
?>
translation: {
nameLabel: 'Imię i nazwisko',
nameError: 'Wpisz imię i nazwisko',
emailLabel: 'E-mail',
emailError: 'Wpisz poprawmy e-mail',
subjectLabel: 'Temat wiadomości',
subjectError: 'Wpisz temat',
messageLabel: 'Jak możemy Ci pomóc?',
messageError: 'Wpisz wiadomość',
sendLabel: 'Wyślij',
contactSuccessLabel: 'Wiadomość wysłana!',
contactSuccessDescription: 'Dziękujemy za kontakt. Wkrótce odpiszemy na Twój e-mail.',
attachFileLabel: 'Załącz plik',
attachFileError: 'Maksymalny rozmiar pliku to 10 MB.'
},
<?php } ?>
attachment: true
});
HS.beacon.ready(function() {
HS.beacon.identify({
name: '<?php echo $user->user_login ?>',
email: '<?php echo $user->user_email ?>',
'Link': '<?php echo $current_url ?>'
});
});
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment