How to add Google tag manager in SuiteCRM

Hii, I am using SuiteCRM 7.14.4 and I need to use google analytics for website tracking, for which I have created account in Google tag manager but have no idea where to add those snippets in the code of suitecrm.
I need to add a snippet in head section of the crm and another snippet in body section for connecting it with google tag manager. But I am unable to find those files.

Any suggestions for this?

Can I ask why? What are you trying to track?

Website Tag Management Tools & Solutions - Google Tag Manager

Manage all your website tags without editing code. Google Tag Manager delivers simple, reliable, easily integrated tag management solutions— for free.

1 Like

I want to track who has visited the crm and what activities he has performed in the CRM. Is there any existing functionality in suiteCRM? If not then I need to integrate Google analytics in the crm.

Thanks I will check it out. Have you tried this before?

No, I haven’t tried it before.

You can achieve it by adding these to the Theme files.

For <head>,
Open themes/SuiteP/tpls/_head.tpl and add after <head> tag,

For <body>,
Open themes/SuiteP/tpls/header.tpl and add after the <body onMouseOut="closeMenus();"> tag

Make sure to execute the R&R afterwards.

Note: There might be separate / individual head and body tags for certain views and page, so you might need to go through all of those to add your scripts.

1 Like

You can use ‘after_ui_frame’ logic hook to append scripts to body. SuiteCRM : add global JavaScript | SL Data Tech

Thank you for telling the path directory, I will try to integrate it.

Well I do not have much idea about it but will try it for sure. Thanks

To integrate Google Tag Manager (GTM) with SuiteCRM, you'll need to add the GTM snippets to the appropriate template files in To integrate Google Tag Manager (GTM) with SuiteCRM, you'll need to add the GTM snippets to the appropriate template files in SuiteCRM.

You can find template files at the following location:

  1. themes/SuiteP/tpls/_head.tpl
  2. themes/SuiteP/tpls/footer.tpl

To add your scripts, you can create new files in the custom directory at the following location:

  1. custom/themes/SuiteP/tpls/_head.tpl
  2. custom/themes/SuiteP/tpls/footer.tpl

Copy the contents of the original files to the custom files.
Then, add the GTM scripts to the custom files at the appropriate location. For example, you can add the GTM scripts just before the closing tag in the _head.tpl file and just before the closing tag in the footer.tpl file.
After making these changes, clear the SuiteCRM cache. You can do this by navigating to Admin > Repair > Quick Repair and Rebuild.SuiteCRM.