add bouncing rate + adjustments

This commit is contained in:
Emily
2024-09-30 17:01:16 +02:00
parent 1828edf98b
commit 3ba6cd171b
12 changed files with 391 additions and 57 deletions

View File

@@ -47,18 +47,24 @@ onMounted(async () => {
const creatingCsv = ref<boolean>(false);
async function downloadCSV() {
async function downloadCSV(isGoogle: boolean) {
creatingCsv.value = true;
const result = await $fetch(`/api/project/generate_csv?mode=visits&slice=${options.indexOf(selectedTimeFrom.value)}`, signHeaders());
const blob = new Blob([result], { type: 'text/csv' });
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'ReportVisits.csv';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
const result = await $fetch(`/api/project/generate_csv?mode=visits&slice=${options.indexOf(selectedTimeFrom.value)}`,
signHeaders({ 'x-google-export': isGoogle ? 'true' : 'false' })
);
if (!isGoogle) {
const blob = new Blob([result as any], { type: 'text/csv' });
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'ReportVisits.csv';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
} else {
alert(result);
}
creatingCsv.value = false;
}
@@ -78,7 +84,6 @@ function goToUpgrade() {
</script>
<template>
@@ -102,16 +107,21 @@ function goToUpgrade() {
<USelectMenu v-model="selectedTimeFrom" :options="options"></USelectMenu>
</div>
<div v-if="isPremium" @click="downloadCSV()"
<div v-if="isPremium" @click="downloadCSV(false)"
class="bg-[#57c78fc0] hover:bg-[#57c78fab] cursor-pointer text-text poppins font-semibold px-8 py-2 rounded-lg">
Download CSV
</div>
<div v-if="!isPremium" @click="goToUpgrade()"
<div v-if="isPremium" @click="downloadCSV(true)"
class="bg-[#57c78fc0] hover:bg-[#57c78fab] cursor-pointer text-text poppins font-semibold px-8 py-2 rounded-lg">
Export CSV to Google Sheets
</div>
<!-- <div v-if="!isPremium" @click="goToUpgrade()"
class="bg-[#57c78f46] hover:bg-[#57c78f42] flex gap-4 items-center cursor-pointer text-text poppins font-semibold px-8 py-2 rounded-lg">
<i class="far fa-lock"></i>
Upgrade plan for CSV
</div>
</div> -->
</div>