To integrate Google Analytics event tracking,
- Go to analytics.google.com (Google Analytics) and login with your credentials.
- Open the source code/main script of your website.
Copy the entire script at this link and paste it on your website. This is a sample script.
Modify the following lines,
ga('create', 'UA-XXXXXXXX-1', 'auto', 'FreshchatEvents');
Go to Web Messenger Settings in Freshchat.
Copy the token value in Step 2.
Replace it with “WEB_CHAT_TOKEN” in the above lines.
Go back to Google Analytics (GA) page.
Select User Management.
Click Tracking Info and then select Tracking Code.
Copy the tracking ID.
Paste it in the script, replacing it with "UA-XXXXXXXX-1".
Go to tagmanager.google.com and login with your credentials.
Select the required Container. You will redirected to the Workspace page.
Click Add a new tag. A window appears.
Enter the Tag title.
Click Tag Configuration. The Choose tag type window appears.
Select Custom HTML.
Paste this code in the HTML text area.
Select the Support document write option.
Click Advanced Settings.
Select Only fire this tag in published containers option.
Select All Pages. Click Add.
Click Save. You will be redirected to Workspace.
Click Submit. The Submit Changes window appears.
Enter the Version Name and Version Description.
You can also refer the following video, which demonstrates the above steps.
The above video is only for your reference on where to add the code. It does not contain the code itself. Please refer the link in Steps 3 & 7 for the actual code.