📊 feat: Google tag manager integration (#2469)

* Google tag manager integration

* change location of react-gtm-module package

* refactor: move react-gtm-module usage from Chat/Footer to useAppStartup hook

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
Denis Palnitsky 2024-06-15 14:09:18 +02:00 committed by GitHub
parent 4416f69a9b
commit 97d12d03d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 29 additions and 0 deletions

View file

@ -1,9 +1,11 @@
import React from 'react';
import ReactMarkdown from 'react-markdown';
import TagManager from 'react-gtm-module';
import { Constants } from 'librechat-data-provider';
import { useGetStartupConfig } from 'librechat-data-provider/react-query';
import { useLocalize } from '~/hooks';
export default function Footer({ className }: { className?: string }) {
const { data: config } = useGetStartupConfig();
const localize = useLocalize();
@ -33,6 +35,13 @@ export default function Footer({ className }: { className?: string }) {
</a>
);
if (config?.analyticsGtmId) {
const tagManagerArgs = {
gtmId: config?.analyticsGtmId,
};
TagManager.initialize(tagManagerArgs);
}
const mainContentParts = (
typeof config?.customFooter === 'string'
? config.customFooter