Skip to content

Commit

Permalink
[DEV-2025] Add Matomo event call in chatbot button callback (#1275)
Browse files Browse the repository at this point in the history
* add matomo event call in chatbot button callback

* revert layout update

* Update apps/nextjs-website/src/components/atoms/ChatButton/ChatButton.tsx

* add changeset

---------

Co-authored-by: marcobottaro <[email protected]>
  • Loading branch information
MarBert and marcobottaro authored Dec 20, 2024
1 parent 3f202f7 commit fd6bfde
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/quiet-rings-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextjs-website": patch
---

Add push event for chatbot button click
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@ type ChatButtonProps = {
size: 'medium' | 'large';
};

const matomoEvent = () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const _paq = (window as any)._paq || [];
// eslint-disable-next-line functional/immutable-data
_paq.push(['trackEvent', 'Chatbot interaction', 'Click chatbot', 'Click']);
};
const ChatButton = ({ isChatOpen, onOpenChat, size }: ChatButtonProps) => {
const { palette } = useTheme();
return (
<Box sx={{ opacity: isChatOpen ? 0 : 1 }}>
<Fab
aria-label='chat'
onClick={onOpenChat}
onClick={(e) => {
matomoEvent();
onOpenChat(e);
}}
size={size}
sx={{
borderStyle: 'solid',
Expand Down

0 comments on commit fd6bfde

Please sign in to comment.