Fixed element event tracking
All checks were successful
Next.js App CI / docker (push) Successful in 4m37s
All checks were successful
Next.js App CI / docker (push) Successful in 4m37s
This commit is contained in:
@@ -53,6 +53,9 @@ export function PublicationCard({
|
||||
.then(() => {
|
||||
setCopyStatus("success");
|
||||
setTimeout(() => setCopyStatus("idle"), 2000);
|
||||
if (window.umami) {
|
||||
window.umami.track(`${bibtexKey}-bibtex-copy`);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("Failed to copy BibTeX:", err);
|
||||
@@ -75,6 +78,18 @@ export function PublicationCard({
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url); // Clean up immediately
|
||||
if (window.umami) {
|
||||
window.umami.track(`${bibtexKey}-bibfile-download`);
|
||||
}
|
||||
};
|
||||
|
||||
const handlePDF = () => {
|
||||
if (pdfUrl) {
|
||||
if (window.umami) {
|
||||
window.umami.track(`${bibtexKey}-pdf-open`);
|
||||
}
|
||||
window.open(pdfUrl, "_blank", "noopener,noreferrer");
|
||||
}
|
||||
};
|
||||
|
||||
const handleCardClick = () => {
|
||||
@@ -137,14 +152,13 @@ export function PublicationCard({
|
||||
<div className="z-10 flex flex-shrink-0 flex-col space-y-1">
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<TrackedButton
|
||||
<Button
|
||||
variant={buttonStyle}
|
||||
size={buttonSize}
|
||||
className="h-7 w-7 cursor-pointer px-2 hover:border"
|
||||
onClick={handleDownload}
|
||||
eventName={`${bibtexKey}-bibfile`}>
|
||||
onClick={handleDownload}>
|
||||
<FileText className="h-4 w-4" />
|
||||
</TrackedButton>
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<p>Download BibTeX</p>
|
||||
@@ -153,18 +167,17 @@ export function PublicationCard({
|
||||
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<TrackedButton
|
||||
<Button
|
||||
variant={buttonStyle}
|
||||
size={buttonSize}
|
||||
className="relative h-7 w-7 cursor-pointer px-2 hover:border"
|
||||
onClick={handleCopy}
|
||||
eventName={`${bibtexKey}-copycite`}>
|
||||
onClick={handleCopy}>
|
||||
{copyStatus === "idle" && <Copy className="h-4 w-4" />}
|
||||
{copyStatus === "success" && (
|
||||
<Check className="h-4 w-4 text-green-500" />
|
||||
)}
|
||||
{copyStatus === "error" && <X className="h-4 w-4 text-red-500" />}
|
||||
</TrackedButton>
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<p>Copy Citation</p>
|
||||
@@ -178,15 +191,8 @@ export function PublicationCard({
|
||||
variant={buttonStyle}
|
||||
size={buttonSize}
|
||||
className="h-7 w-7 px-2 hover:border"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
asChild>
|
||||
<TrackedLink
|
||||
href={pdfUrl}
|
||||
target="_blank"
|
||||
eventName={`${bibtexKey}-pdf`}
|
||||
rel="noopener noreferrer">
|
||||
<BookOpen className="h-4 w-4" />
|
||||
</TrackedLink>
|
||||
onClick={handlePDF}>
|
||||
<BookOpen className="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
|
||||
Reference in New Issue
Block a user