Joomla Analytics and Live Chat
Last updated: 2nd September, 2021
This guide takes you through the steps to add the GoSquared code to your Joomla site. Adding the code will enable you to use:
- Now – real time analytics dashboard
- Trends – historical analytics dashboard
- Assistant – on site messaging for your visitors
- Contacts – user level profile tracking
⚠️ Please note, we have now deprecated the Joomla plugin for automating the GoSquared installation. You can however, use the instructions below to install GoSquared manually into your Joomla site.
Installation Instructions
This guide assumes you've already signed up for a GoSquared account.
Log into your Joomla Control Panel.
Select Extensions > Templates > Templates from the dropdown in the top menu bar.
From within the Editor tab, select the index.php file from the list on the left hand side. This page contains content that will get used across the whole site, so it's the easiest place to add your GoSquared code.
Now that you know where to add the code, next you'll need to copy and paste your GoSquared Analytics code into the index.php file, just before the closing tag
</head>
tag. This is enough to start using the Now, Trends and Inbox.To create and Contact profiles you'll need to add some more code. Scroll up to the top of the index.php file to find your list of definitions. You need to ensure you have a
$user
object defined. If the template you're using doesn't already do this for you, you'll need to add this code:$user = JFactory::getUser();
to the definition list as shown in the example below:
Now that we have access to the
$user
object, we can use the identify method to pass back the user's details to GoSquared. In order to populate the identify method with their details, you’ll need to store the values in variables that can then be passed into the identify method. Through Joomla you have access to the all of these Object Member Variables and Parameters. So you’re code will look something like the below:<script> //store the user details in variables var userEmail = <?php echo json_encode($user->email ); ?>; var userName = <?php echo json_encode($user->name ); ?>; var userUsername = <?php echo json_encode($user->username ); ?>; //then pass the variables into the identify method _gs('identify', { email: userEmail, name: userName, username: userUsername, }); </script>
You need to add this code underneath the main GoSquared Analytics code that you've already added, again before the closing
</head>
tag.Now, next time a user logs in, their id, email address, name and username will be used to created a profile in GoSquared. Any actions they take during their session will attributed to this profile and you'll know who you're talking to when they send you a Live Chat message.