mirror of
https://github.com/uetchy/namae.git
synced 2025-03-17 04:30:31 +09:00
chore: update analytics
This commit is contained in:
parent
ea61ecc9dc
commit
095895f7cf
@ -7,10 +7,10 @@ import BarLoader from 'react-spinners/BarLoader';
|
||||
import {GoInfo} from 'react-icons/go';
|
||||
import {IoIosFlash} from 'react-icons/io';
|
||||
import {useTranslation} from 'react-i18next';
|
||||
import {sendError, sendExpandEvent} from '../../util/analytics';
|
||||
import {OutboundLink} from 'react-ga';
|
||||
|
||||
import {sendError, sendExpandEvent} from '../../util/analytics';
|
||||
import {mobile} from '../../util/css';
|
||||
import {ExternalLink} from '../Links';
|
||||
|
||||
const COLORS = {
|
||||
available: '#6e00ff',
|
||||
@ -210,7 +210,12 @@ export const Result: React.FC<{
|
||||
<ResultIcon>{icon}</ResultIcon>
|
||||
<ResultName>
|
||||
{link ? (
|
||||
<ExternalLink href={link}>{content}</ExternalLink>
|
||||
<OutboundLink
|
||||
to={link}
|
||||
eventLabel={link.split('/')[2]}
|
||||
target="_blank">
|
||||
{content}
|
||||
</OutboundLink>
|
||||
) : (
|
||||
content
|
||||
)}
|
||||
|
@ -20,7 +20,7 @@ const Search: React.FC<{query: string}> = ({query}) => {
|
||||
id: string;
|
||||
}>;
|
||||
};
|
||||
const repos = response.items;
|
||||
const repos = response.items || [];
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -10,14 +10,13 @@ export function initHistoryWithGA() {
|
||||
ReactGA.initialize('UA-28919359-15');
|
||||
ReactGA.pageview(window.location.pathname + window.location.search);
|
||||
history.listen((location) => {
|
||||
ReactGA.set({page: location.pathname});
|
||||
ReactGA.pageview(location.pathname);
|
||||
ReactGA.pageview(location.pathname + location.search);
|
||||
});
|
||||
}
|
||||
return history;
|
||||
}
|
||||
|
||||
export function track({
|
||||
export function trackEvent({
|
||||
category,
|
||||
action,
|
||||
label = undefined,
|
||||
@ -39,23 +38,23 @@ export function track({
|
||||
}
|
||||
|
||||
export function sendQueryEvent(query: string): void {
|
||||
track({category: 'Search', action: 'search', label: query});
|
||||
trackEvent({category: 'Search', action: 'search', label: query});
|
||||
}
|
||||
|
||||
export function sendExampleQueryEvent(query: string): void {
|
||||
track({category: 'Search', action: 'tryExampleQuery', label: query});
|
||||
trackEvent({category: 'Search', action: 'tryExampleQuery', label: query});
|
||||
}
|
||||
|
||||
export function sendExpandEvent(): void {
|
||||
track({category: 'Result', action: 'expand'});
|
||||
trackEvent({category: 'Result', action: 'expand'});
|
||||
}
|
||||
|
||||
export function sendAcceptSuggestionEvent(): void {
|
||||
track({category: 'Suggestion', action: 'accept'});
|
||||
trackEvent({category: 'Suggestion', action: 'accept'});
|
||||
}
|
||||
|
||||
export function sendShuffleSuggestionEvent(): void {
|
||||
track({category: 'Suggestion', action: 'shuffle'});
|
||||
trackEvent({category: 'Suggestion', action: 'shuffle'});
|
||||
}
|
||||
|
||||
export function initSentry(): void {
|
||||
|
Loading…
x
Reference in New Issue
Block a user