mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-30 16:24:24 +00:00
docs[patch]: Update how GA4 is collected (#18821)
There's some issue/setting with the current python GA4 app. I created a new one just for feedback.
This commit is contained in:
parent
a8de6d1533
commit
9c218d0154
@ -335,6 +335,10 @@ const config = {
|
||||
src: "https://www.googletagmanager.com/gtag/js?id=G-9B66JQQH2F",
|
||||
async: true,
|
||||
},
|
||||
{
|
||||
src: "https://www.googletagmanager.com/gtag/js?id=G-WFT0J048RF",
|
||||
async: true,
|
||||
}
|
||||
],
|
||||
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
export default function gtag(...args) {
|
||||
if (window.gtag) {
|
||||
window.gtag(...args);
|
||||
if (window.gtagFeedback) {
|
||||
window.gtagFeedback(...args);
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ export default function Feedback() {
|
||||
const [feedbackSent, setFeedbackSent] = useState(false);
|
||||
|
||||
/**
|
||||
* @param {"yes" | "no"} feedback
|
||||
* @param {"good" | "bad"} feedback
|
||||
*/
|
||||
const handleFeedback = (feedback) => {
|
||||
const cookieName = `${FEEDBACK_COOKIE_PREFIX}_${window.location.pathname}`;
|
||||
@ -105,15 +105,12 @@ export default function Feedback() {
|
||||
return;
|
||||
}
|
||||
|
||||
const feedbackType =
|
||||
const feedbackEnv =
|
||||
process.env.NODE_ENV === "production"
|
||||
? "page_feedback"
|
||||
: "page_feedback_dev";
|
||||
|
||||
gtag("event", feedbackType, {
|
||||
url: window.location.pathname,
|
||||
feedback,
|
||||
});
|
||||
gtag("event", `${feedbackEnv}_${feedback}`, {});
|
||||
// Set a cookie to prevent feedback from being sent multiple times
|
||||
setCookie(cookieName, window.location.pathname, 1);
|
||||
setFeedbackSent(true);
|
||||
@ -168,12 +165,12 @@ export default function Feedback() {
|
||||
// Handle keyboard interaction
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.preventDefault();
|
||||
handleFeedback("yes");
|
||||
handleFeedback("good");
|
||||
}
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
handleFeedback("yes");
|
||||
handleFeedback("good");
|
||||
}}
|
||||
>
|
||||
<SvgThumbsUp />
|
||||
@ -186,12 +183,12 @@ export default function Feedback() {
|
||||
// Handle keyboard interaction
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.preventDefault();
|
||||
handleFeedback("no");
|
||||
handleFeedback("bad");
|
||||
}
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
handleFeedback("no");
|
||||
handleFeedback("bad");
|
||||
}}
|
||||
>
|
||||
<SvgThumbsDown />
|
||||
|
14
docs/static/js/google_analytics.js
vendored
14
docs/static/js/google_analytics.js
vendored
@ -1,7 +1,11 @@
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() {
|
||||
dataLayer.push(arguments);
|
||||
}
|
||||
gtag("js", new Date());
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag("config", "G-9B66JQQH2F");
|
||||
gtag('config', 'G-9B66JQQH2F');
|
||||
|
||||
// Only for feedback
|
||||
function gtagFeedback(){dataLayer.push(arguments);}
|
||||
gtagFeedback('js', new Date());
|
||||
|
||||
gtagFeedback('config', 'G-WFT0J048RF');
|
Loading…
Reference in New Issue
Block a user