Home / Guide
Installation guide
Install in two steps
- Upload
nut-<name>.jsfrom the package to your site (for example the/nut/folder). - Paste one script line and put the tag where the button should appear:
<script defer src="/nut/nut-sao-chep-link.js"></script>
<nut-sao-chep-link></nut-sao-chep-link>If you bought a whole set, loading the single bo-<name>.js file gives you every button in it.
Shared attributes
Attribute names are Vietnamese keywords and work the same on any site.
| Attribute | Meaning | Example |
|---|---|---|
mau | Button background, set it to your brand color | mau="#e8590c" |
mau-chu | Text and icon color | mau-chu="#fff" |
nhan | Button text | nhan="SEND TO A FRIEND" |
kieu | icon = 44px round icon only · vien = outline button | kieu="icon" |
rong | Full-width button | rong |
ghi-luot | Path to the PHP file that logs clicks | ghi-luot="/ghi-luot.php" |
Language
Button text, messages and dialogs follow the page language: English on <html lang="en">, Vietnamese on <html lang="vi">. To force one:
<script>window.KHO_NUT_CAU_HINH = { ngonNgu: 'en' };</script>Buttons with a server part
Buttons that store data (VISITORS, GET ADVICE ON ZALO…) ship with a PHP file. Upload it and point the button's attribute at it (nguon, gui-ve). Data is written to a private file on your own hosting.
Turn buttons on and off in one place
<script>window.KHO_NUT_TAT = ['chia-se-facebook', 'chat-zalo'];</script>Put this before the button script (for example in a shared header). Buttons named in the list hide themselves site-wide.
Know which button gets tapped
Every tap fires a nut-bam event you can forward to your analytics:
<script>
document.addEventListener('nut-bam', function (e) {
console.log('Button tapped', e.detail.nut);
});
</script>Notes
- Do not place buttons inside an element with
transformorfilter; the button's dialog may be misplaced. - Load the script with
deferso buttons never slow the page.
Share this: