mirror of
https://github.com/NohamR/gitprofile.git
synced 2026-05-25 04:17:13 +00:00
Add google analytics
This commit is contained in:
@@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
|
||||
import { CgHashtag } from 'react-icons/cg';
|
||||
import { useSelector } from "react-redux";
|
||||
import config from "../config";
|
||||
import { skeleton } from "../helpers/utils";
|
||||
import { ga, skeleton } from "../helpers/utils";
|
||||
import LazyImage from "./LazyImage";
|
||||
|
||||
const Blog = () => {
|
||||
@@ -82,10 +82,19 @@ const Blog = () => {
|
||||
|
||||
const renderArticles = () => {
|
||||
return articles && articles.slice(0, config.blog.limit).map((article, index) => (
|
||||
<div
|
||||
className="card shadow-lg compact bg-base-100 cursor-pointer"
|
||||
<div
|
||||
className="card shadow-lg compact bg-base-100 cursor-pointer"
|
||||
key={index}
|
||||
onClick={() => {
|
||||
if (config.googleAnalytics.id) {
|
||||
ga.event({
|
||||
action: "Click Blog Post",
|
||||
params: {
|
||||
post: article.title
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.open(article.link, '_blank')
|
||||
}}
|
||||
>
|
||||
@@ -94,7 +103,7 @@ const Blog = () => {
|
||||
<div className="avatar mb-5 md:mb-0 opacity-90">
|
||||
<div className="w-24 h-24 mask mask-squircle">
|
||||
<LazyImage
|
||||
src={article.thumbnail}
|
||||
src={article.thumbnail}
|
||||
alt={'thumbnail'}
|
||||
placeholder={
|
||||
skeleton({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Fragment } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { languageColor, skeleton } from "../helpers/utils";
|
||||
import { ga, languageColor, skeleton } from "../helpers/utils";
|
||||
import { AiOutlineStar, AiOutlineFork } from 'react-icons/ai';
|
||||
import config from "../config";
|
||||
|
||||
@@ -52,10 +52,19 @@ const Project = () => {
|
||||
|
||||
const renderProjects = () => {
|
||||
return repo.map((item, index) => (
|
||||
<div
|
||||
className="card shadow-lg compact bg-base-100 cursor-pointer"
|
||||
<div
|
||||
className="card shadow-lg compact bg-base-100 cursor-pointer"
|
||||
key={index}
|
||||
onClick={() => {
|
||||
if (config.googleAnalytics.id) {
|
||||
ga.event({
|
||||
action: "Click project",
|
||||
params: {
|
||||
project: item.name
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.open(item.html_url, '_blank')
|
||||
}}
|
||||
>
|
||||
@@ -76,11 +85,11 @@ const Project = () => {
|
||||
<div className="flex justify-between text-sm text-base-content text-opacity-60">
|
||||
<div className="flex flex-grow">
|
||||
<span className="mr-3 flex items-center">
|
||||
<AiOutlineStar className="mr-0.5"/>
|
||||
<AiOutlineStar className="mr-0.5" />
|
||||
<span>{item.stargazers_count}</span>
|
||||
</span>
|
||||
<span className="flex items-center">
|
||||
<AiOutlineFork className="mr-0.5"/>
|
||||
<AiOutlineFork className="mr-0.5" />
|
||||
<span>{item.forks_count}</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user