Adding a videoask widget to specific pages:
Go to the Settings > Tracking & Analytics page:
- Click "+ New tool" > "Custom Code"
- Copy the following code and modify the parts highlighted:
<script>
// Customise your widget options here
window.videoask_config = {
"kind": "widget",
"url": "https://www.videoask.com/fn5pz0q1v",
"options": {
"widgetType": "VideoThumbnailExtraLarge",
"text": "Talk to me",
"backgroundColor": "#FF3C4C",
"position": "bottom-right"
}
}
// Specify the pages where you want it to load
window.videoask_pages = [
'/widget',
'/widget-specific-pages'
]
</script>
<script src="https://www.videoask.com/embed/embed.js"></script>
<script>
let widget = null;
function handlePageView() {
if (window.videoask_pages.indexOf(window.location.pathname) !== -1) {
if (widget) return;
window.videoask.loadEmbed(window.videoask_config).then(function (el) {
widget = el;
});
} else if (widget && document.body && document.body.contains(widget)) {
document.body.removeChild(widget);
widget = null;
}
}
function locationChecker() {
var previousPathname = window.location.pathname;
setInterval(function () {
if (previousPathname !== window.location.pathname) {
previousPathname = window.location.pathname;
handlePageView();
}
}, 500);
}
handlePageView();
locationChecker();
</script>
