digitaltown
Member
Well, I'm creating a Workflow that start with a webhook that's called by a javascript in that page with that url (can only change the email address)
The js call the webhook if the user see at least 30 seconds of the movie in that page.
Well, I've tried the webhook on Zapier and it's called correctly after 30 seconds but that's not happening on Pabbly where the webhook is never called.
That's the js on that page. If I replace the zapUrl with the one from zapier, everything works but with Pabbly nothing happens.
In my account there are 2 workflow - Video Tracking and videotracking. The latter was created to have a new webhook but nothing happens. If you need something please ask since I really don't know why Zapier works and Pabbly not.
Thanks
Caso di Studio 100% Gratis
www.digitaltown.space
The js call the webhook if the user see at least 30 seconds of the movie in that page.
Well, I've tried the webhook on Zapier and it's called correctly after 30 seconds but that's not happening on Pabbly where the webhook is never called.
That's the js on that page. If I replace the zapUrl with the one from zapier, everything works but with Pabbly nothing happens.
In my account there are 2 workflow - Video Tracking and videotracking. The latter was created to have a new webhook but nothing happens. If you need something please ask since I really don't know why Zapier works and Pabbly not.
Thanks
Code:
<script src="https://player.vimeo.com/api/player.js"></script>
<script style="text/javascript">
//NOTA: per far funzionare questo script serve includere questo javascript nell'header della pagina:
//https://player.vimeo.com/api/player.js
var zapUrl = "https://connect.pabbly.com/workflow/sendwebhookdata/IjU3NjMwNTY1MDYzZTA0MzA1MjY5NTUzYyI_3D_pc",
vidCheckpoints = [
//min 1
{secondi: 30, messaggio: "Arrivato al sec 30 - molto bravo e professionale"},
//min 70
{secondi: 4200, messaggio: "Arrivato al min 1:10:00 Descrizione punto del video"},
//min 1:50:45
{secondi: 6645, messaggio: "Arrivato al min 1:50:45Descrizione punto del video"},
//min 2:19:00
{secondi: 8340, messaggio: "Arrivato al min 2:19:00 Descrizione punto del video"}
];
//funzione ausiliaria che setta un cookie
function setCookie(nome, valore, ggScadenza, path) {
if (path == undefined) {
path = "/";
}
var d = new Date();
d.setTime(d.getTime() + (ggScadenza * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toUTCString();
document.cookie = nome + "=" + valore + "; " + expires + "; path=" + path;
}
//funzione ausiliaria che legge un cookie
function getCookie(nome) {
var name = nome + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ')
c = c.substring(1);
if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
}
return "";
}
//checkparametro email in URL
var getUrlParameter1 = function getUrlParameter(sParam) {
var sPageURL = window.location.search.substring(1),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
}
}
};
$(function() {
var emailContatto = getUrlParameter1("contactEmail");
//trovo la prima parte del nome del cookie
var pagepathArr = window.location.pathname.split("/"),
pagepath = pagepathArr[pagepathArr.length - 1],
nomeCookie = "movie_" + pagepath;
//console.log("emailContatto= " + emailContatto)
//se non esiste parametro email controllo cookie se lo trovo li lo aggiorno, altrimenti se lo trovo ma non c'è il cookie, setto il cookie
var coockieEmail = nomeCookie+"_email";
if(!emailContatto){
if(getCookie(coockieEmail)){
emailContatto = getCookie(coockieEmail);
}
}else if(!getCookie(coockieEmail)){
setCookie(coockieEmail, emailContatto);
}
//console.log("getCookie(coockieEmail) = " + getCookie(coockieEmail))
//agisco solo se ho la mail o il cookie della mail
//console.log(typeof emailContatto);
if(emailContatto != false && typeof emailContatto != "undefined"){
function inviaAZapier(messDaInviare) {
$.ajax({
type: "POST",
url: zapUrl,
data: {
email: emailContatto,
messaggio: messDaInviare,
link: String(window.location).split("?")[0]
},
success: function(data) {
//console.log(+JSON.stringify(data))
console.log(data.status == "success" ? "Messaggio aggiunto con successo" : "Mess non Aggiunto: c'è stato un errore");
}
});
};
var iframe = $('#miovideo1')[0],
player = new Vimeo.Player(iframe);
player.on('timeupdate', function(data) {
var vidDuration = data.duration;
player.getCurrentTime().then(function(seconds) {
//console.log("duration - " + vidDuration)
//console.log("played - "+seconds )
vidCheckpoints.forEach(function(objVid){
//se è maggiore dei secondi dell'oggetto (e non mai fatto la chiamata, ovvero non c'è cookie) mando chiamata API a Zapier
var coockieDaSalvare = nomeCookie+"_"+objVid.secondi;
if (seconds > objVid.secondi && !getCookie(coockieDaSalvare)) {
inviaAZapier(objVid.messaggio);
//settaCookie che è stato salvato quel checkpoint
setCookie(coockieDaSalvare, true, 10);
console.log("aggiorno zapier che ha visto "+objVid.secondi+" secondi del video...");
}
});
});
});
}
});
</script>