mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
📊 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:
parent
4416f69a9b
commit
97d12d03d1
7 changed files with 29 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { useEffect } from 'react';
|
||||
import TagManager from 'react-gtm-module';
|
||||
import { useRecoilState, useSetRecoilState } from 'recoil';
|
||||
import { LocalStorageKeys } from 'librechat-data-provider';
|
||||
import { useAvailablePluginsQuery } from 'librechat-data-provider/react-query';
|
||||
|
|
@ -98,4 +99,11 @@ export default function useAppStartup({
|
|||
|
||||
setAvailableTools({ pluginStore, ...mapPlugins(tools) });
|
||||
}, [allPlugins, user, setAvailableTools]);
|
||||
|
||||
if (startupConfig?.analyticsGtmId) {
|
||||
const tagManagerArgs = {
|
||||
gtmId: startupConfig?.analyticsGtmId,
|
||||
};
|
||||
TagManager.initialize(tagManagerArgs);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue