Google Analytics events

This commit is contained in:
Kasper Rynning-Tønnesen
2018-02-25 22:42:53 +01:00
parent 48cd95a11e
commit 5aadb5ab4f
6 changed files with 40 additions and 8 deletions

View File

@@ -575,7 +575,7 @@ footer{
right:0px; right:0px;
} }
.help-button-footer{ .help-button-footer, .embed-button-footer, .contact-button-footer{
width:17em; width:17em;
background: #1e88e5; background: #1e88e5;
border-radius: 2px; border-radius: 2px;

View File

@@ -105,6 +105,7 @@ var Channel = {
$(".offline_switch_class")[0].checked = true; $(".offline_switch_class")[0].checked = true;
change_offline(true, offline); change_offline(true, offline);
} }
if(!Helper.mobilecheck() && ($("#alreadychannel").length === 0 || !Hostcontroller.old_id || $("#code-text").text().toUpperCase() == "ABBADUR")) setup_host_initialization();
if($("#alreadychannel").length === 0 || Helper.mobilecheck()){ if($("#alreadychannel").length === 0 || Helper.mobilecheck()){
setup_youtube_listener(); setup_youtube_listener();
@@ -197,8 +198,6 @@ var Channel = {
socket.emit("get_history", {channel: chan.toLowerCase(), all: false}); socket.emit("get_history", {channel: chan.toLowerCase(), all: false});
socket.emit("get_history", {channel: chan.toLowerCase(), all: true}); socket.emit("get_history", {channel: chan.toLowerCase(), all: true});
if(!Helper.mobilecheck() && ($("#alreadychannel").length === 0 || !Hostcontroller.old_id || $("#code-text").text().toUpperCase() == "ABBADUR")) setup_host_initialization();
if(!Helper.msieversion() && !Helper.mobilecheck()) Notification.requestPermission(); if(!Helper.msieversion() && !Helper.mobilecheck()) Notification.requestPermission();
$(".search_input").focus(); $(".search_input").focus();

View File

@@ -252,6 +252,7 @@ function embed_code(autoplay, width, height, color, embed_code){
function change_offline(enabled, already_offline){ function change_offline(enabled, already_offline){
Crypt.set_offline(enabled); Crypt.set_offline(enabled);
offline = enabled; offline = enabled;
ga('send', 'event', "button-click", "offline", "", offline ? 1 : 0);
socket.emit("offline", {status: enabled, channel: chan != undefined ? chan.toLowerCase() : ""}); socket.emit("offline", {status: enabled, channel: chan != undefined ? chan.toLowerCase() : ""});
if(!Helper.mobilecheck()) { if(!Helper.mobilecheck()) {
$("#offline-mode").tooltip('remove'); $("#offline-mode").tooltip('remove');

View File

@@ -560,6 +560,8 @@ var List = {
}, },
exportToSpotify: function() { exportToSpotify: function() {
ga('send', 'event', "export", "spotify");
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: "https://api.spotify.com/v1/me", url: "https://api.spotify.com/v1/me",
@@ -742,6 +744,8 @@ var List = {
}, },
exportToYoutube: function() { exportToYoutube: function() {
ga('send', 'event', "export", "youtube");
var request_url = "https://www.googleapis.com/youtube/v3/playlists?part=snippet"; var request_url = "https://www.googleapis.com/youtube/v3/playlists?part=snippet";
$(".exported-list-container").removeClass("hide"); $(".exported-list-container").removeClass("hide");
$("#playlist_loader_export").removeClass("hide"); $("#playlist_loader_export").removeClass("hide");

View File

@@ -422,7 +422,6 @@ $(document).on("click", "#offline-mode", function(e){
} else{ } else{
change_offline(false, offline); change_offline(false, offline);
} }
}); });
$(document).on("submit", "#thumbnail_form", function(e){ $(document).on("submit", "#thumbnail_form", function(e){
@@ -606,6 +605,8 @@ $(document).on("click", ".first_page", function(e){
$(document).on("click", ".donate-button", function(e) { $(document).on("click", ".donate-button", function(e) {
e.preventDefault(); e.preventDefault();
ga('send', 'event', "button-click", "donate");
$("#donate").modal("open"); $("#donate").modal("open");
}); });
@@ -706,6 +707,7 @@ $(document).on("click", "#listExport", function(e){
access_token_data_youtube = {}; access_token_data_youtube = {};
}, access_token_data_youtube.expires_in * 1000); }, access_token_data_youtube.expires_in * 1000);
List.exportToYoutube(); List.exportToYoutube();
} else { } else {
access_token_data_youtube = ""; access_token_data_youtube = "";
console.error("Nonce doesn't match"); console.error("Nonce doesn't match");
@@ -753,6 +755,8 @@ $(document).on("submit", "#listImport", function(e){
document.getElementById("import").disabled = true; document.getElementById("import").disabled = true;
$("#import").addClass("hide"); $("#import").addClass("hide");
$("#playlist_loader").removeClass("hide"); $("#playlist_loader").removeClass("hide");
ga('send', 'event', "import", "youtube");
} else { } else {
before_toast(); before_toast();
Materialize.toast("It seems you've entered a invalid url.", 4000); Materialize.toast("It seems you've entered a invalid url.", 4000);
@@ -774,6 +778,8 @@ $(document).on("submit", "#listImportSpotify", function(e){
$("#import_spotify").addClass("hide"); $("#import_spotify").addClass("hide");
$("#playlist_loader_spotify").removeClass("hide"); $("#playlist_loader_spotify").removeClass("hide");
ga('send', 'event', "import", "spotify");
Search.importSpotifyPlaylist('https://api.spotify.com/v1/users/' + user + '/playlists/' + playlist_id + '/tracks'); Search.importSpotifyPlaylist('https://api.spotify.com/v1/users/' + user + '/playlists/' + playlist_id + '/tracks');
} else { } else {
before_toast(); before_toast();
@@ -870,6 +876,26 @@ $(document).on("click", "#channel-share-modal", function(){
$("#channel-share-modal").modal("close") $("#channel-share-modal").modal("close")
}); });
$(document).on("click", ".shareface", function(e) {
ga('send', 'event', "button-click", "share-facebook");
});
$(document).on("click", ".android-image-link", function() {
ga('send', 'event', "button-click", "android-playstore-link");
});
$(document).on("click", "#twitter-code-link", function() {
ga('send', 'event', "button-click", "share-twitter");
});
$(document).on("click", ".help-button-footer", function() {
ga('send', 'event', "button-click", "help-footer");
});
$(document).on("click", "#embed-button", function() {
ga('send', 'event', "button-click", "embed-channel", "channel-name", chan.toLowerCase());
})
$(document).on("click", ".chat-link", function(e){ $(document).on("click", ".chat-link", function(e){
chat_active = true; chat_active = true;
unseen = false; unseen = false;
@@ -1159,7 +1185,9 @@ $(document).on("click", ".generate-channel-name", function(e) {
$(".room_namer").val(""); $(".room_namer").val("");
$(".room-namer").val(response); $(".room-namer").val(response);
} }
}) });
ga('send', 'event', "button-click", "generate-channel");
}); });
$(document).keydown(function(event) { $(document).keydown(function(event) {

View File

@@ -18,12 +18,12 @@
</a> </a>
</li> </li>
<li> <li>
<a class="modal-trigger waves-effect blue-grey darken-2 btn help-button-footer hide-on-small-only" id="embed-button" title="Want to embed this channel?" data-target="embed"> <a class="modal-trigger waves-effect blue-grey darken-2 btn embed-button-footer hide-on-small-only" id="embed-button" title="Want to embed this channel?" data-target="embed">
<i class="material-icons left footer-button-icon">code</i>EMBED <i class="material-icons left footer-button-icon">code</i>EMBED
</a> </a>
</li> </li>
<li> <li>
<a class="modal-trigger waves-effect red darken-2 btn help-button-footer" id="contact-button" title="Contact us" data-target="contact"> <a class="modal-trigger waves-effect red darken-2 btn contact-button-footer" id="contact-button" title="Contact us" data-target="contact">
<i class="material-icons left footer-button-icon">email</i>CONTACT <i class="material-icons left footer-button-icon">email</i>CONTACT
</a> </a>
</li> </li>
@@ -48,7 +48,7 @@
</a> </a>
</li> </li>
<li class="google-play-image-list"> <li class="google-play-image-list">
<a href="https://play.google.com/store/apps/details?id=zoff.me.zoff&hl=no&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1"> <a class="android-image-link" href="https://play.google.com/store/apps/details?id=zoff.me.zoff&hl=no&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1">
<img alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"/> <img alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"/>
</a> </a>
</li> </li>