You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
Version 1
Next »
Add custom button in your Visualizer.
You can call your functionality by clicking on this button. When a button is clicked, the "customButtonWasClicked" event is sending to the parent window.
To add a custom button you should add the code below to your Deployment Kit integration.
custom_button: {title:"Your button"}
first Integration via a deployment kit.
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no viewport-fit=cover"
/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>Document</title>
</head>
<body>
<script
class="wizart__entry-point"
data-token="YOUR TOKEN"
src="https://d35so7k19vd0fx.cloudfront.net/production/integration/entry-point.min.js"
data-parameters='{"custom_button": {"title":Your button"}}'
></script>
<script>
window.addEventListener('message',()=>{
if(event.data && event.data.eventName === 'customButtonWasClicked'){
console.log('the button was clicked')
//your code
}
}, false);
</script>
</body>
</html>
second integration via a deployment kit.
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no viewport-fit=cover"
/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<script type="application/javascript" src="https://d35so7k19vd0fx.cloudfront.net/production/integration/entry-point.min.js"></script>
<title>Document</title>
</head>
<body>
<script
const entryPoint = new WEntryPoint({
element: document.getElementById("element_id"),
className:'wizart__entry-point',
token: "YOUR TOKEN",
});
entryPoint.render({
tooltipPosition: "bottom",
insertElementPosition: "before",
parameters:JSON.stringify({
custom_button: {title:"Your button"}
}),
});
</script>
<script>
window.addEventListener('message',()=>{
if(event.data && event.data.eventName === 'customButtonWasClicked'){
console.log('the button was clicked')
//your code
}
}, false);
</script>
</body>
</html>