Eventi disponibili a cui è possibile associare JavaScript per le app di conversazione (ad esempio Commenti, Chat, Blog live, Recensioni e Note a margine).
Livefyre fornisce eventi JavaScript per monitorare l’attività dell’utente nelle app Livefyre. Ad esempio, puoi aggiornare la pagina quando gli utenti amano o condividono contenuti su Twitter o Facebook o quando vengono pubblicati nuovi contenuti.
Livefyre consente inoltre di aggiungere eventi alle integrazioni di analisi di terze parti (Adobe Analytics JS, Google Analytics, Dynamic Tag Management, ecc.) per tenere traccia degli eventi delle app. Per ulteriori informazioni, collabora con il tuo gestore di integrazione di terze parti per fornire gli eventi corretti.
Per eseguire il binding a questi eventi, aggiungi il codice seguente alla pagina durante la creazione di un’istanza dell’app su una pagina. Sostituisci il nome dell'evento per {eventName}
:
Livefyre.require(['fyre.conv#3'], function(Conv) {
new Conv(networkConfig, [convConfig], function(widget) {
widget.on('{eventName}', function (data) {
// Do something, perhaps using data
});
});
});
Gli oggetti dati vengono forniti per tutti i gestori eventi. Gli oggetti dati di esempio seguono ogni evento.
Un utente ha postato un commento.
data = {
authorId: "_u2012@livefyre.com" // The ID of the author of the comment
parent: "893549"
// The ID of the comment that this new comment is in reply to, else null
bodyHtml: "<p>42</>" // The HTML of the submitted Content
sharedToFacebook:true // Whether the comment was also posted to Facebook
sharedToTwitter:false // Whether the comment was also posted to Twitter
title: "demo title" // The title of the review (exists only for Reviews)
rating: [90] // Array of ratings for the review (exists only for Reviews)
}
Un utente ha segnalato un commento.
data = {
targetId: "789347" // The ID of the comment that was flagged
type: ["disagree"] // The type of flag
notes: ["I don't entirely agree with this post"] // A note/reason for the flag
}
A un utente piaceva un commento.
data = {
targetId: "245625" // The ID of the comment that was liked
targetAuthorId: "i_am_author@livefyre.com"
// The ID of the author of the comment that was liked
}
Un utente ha condiviso un commento dal flusso. (Questo evento non si attiva quando gli utenti condividono dall’editor Commenti). Questo evento viene attivato quando si fa clic sul pulsante Condividi .
data = {
targetId: "256255" // The ID of the comment that was shared
sharedToFacebook:false // Whether the comment was shared to Facebook
sharedToTwitter:true // Whether the comment was shared to Twitter
}
Il numero totale di commenti visibili in questa conversazione è cambiato (incrementato o diminuito).
data: 34 // The total number of visible comments in the conversation (integer).
Un utente ha effettuato l'accesso.
data = {
avatar: "https://gravatar.com/avatar/50.jpg"
// Link to logged in user's avatar image
displayName: "NewUser" // Display name of the logged in user
id: "newuser@livefyre.com" // ID of the logged in user
isModerator:false // Boolean indicating whether logged in user is a moderator
}
Un utente si è disconnesso.
i dati non sono definiti.
Un utente ha incluso un @mention in un commento. Restituisce una matrice dei seguenti elementi:
data = {
id: '111111@fb.gw.livefyre.com' // ID of the mentioned user
displayName: 'testUser' // Display name of mentioned user
message: "@testUser Wow, I can't believe it either!"
// Message that was sent to the particular user
provider: 'twitter' // Provider to which the mention was shared
}
Un utente moderatore ha presentato un commento. Restituisce una matrice dei seguenti elementi:
data = {
targetId: "134234" // The ID of the comment that was featured
targetAuthorId: "i_am_author@livefyre.com"
// The ID of the author of the comment that was featured
}
Il flusso dei commenti è stato caricato e il set iniziale di contenuti è stato recuperato dal server e visualizzato all’utente.
i dati non sono definiti.
Un utente ha fatto clic sul pulsante Show More .
i dati non sono definiti.
Restituisce true quando un utente fa clic sul pulsante Follow e false quando il contenuto viene inviato al flusso.
data = {
id: 'authorId@livefyre.com',
optIn: true
}
Restituisce true quando un utente fa clic sul pulsante Non seguire e false quando il contenuto viene inviato al flusso.
data = {
id: 'authorId@livefyre.com',
optOut: true
}