Hi Guys,

I have added a script to my website template and somehow it does not work.

I think this could be due to a JS conflict but when using firebug, I cannot see anything abnormal.

Here is the link:


My JS code is as follow

$(document).ready(function ($) {
    // Using jQuery Event API v1.3
  $('#quote_home').on('click', function() {
    ga('send', 'event', 'a', 'click', 'quote_home');
  $('#quote_landlord').on('click', function() {
    ga('send', 'event', 'a', 'click', 'quote_landlord');
  $('#quote_lerg').on('click', function() {
    ga('send', 'event', 'a', 'click', 'quote_lerg');
  $('#quote_business').on('click', function() {
    ga('send', 'event', 'a', 'click', 'quote_business');
  $('#quote_tenant').on('click', function() {
    ga('send', 'event', 'a', 'click', 'quote_tenant');
  $('#quote_holidayhome').on('click', function() {
    ga('send', 'event', 'a', 'click', 'quote_holidayhome');
  $('#quote_referencing').on('click', function() {
    ga('send', 'event', 'a', 'click', 'quote_referencing');
  $('#quote_mortgages').on('click', function() {
    ga('send', 'event', 'a', 'click', 'quote_mortgages');

I am calling the file using this line:

$doc->addScript('templates/protostar/js/tracking.js'); //Google tracking Event Script 

Edited by london-G

2 Years
Discussion Span
Last Post by london-G

In my Chrome console you have this error:
Uncaught TypeError: $(...).ready is not a function

As you have both MooTools (prototype.js) and jQuery on your Joomla site which are using both the dollar sign, you can indeed use the noConflict() method, but than you should use everything else except for the dollar sign. You should do something like this:


jQuery(document).ready(function($) {
    // Now you can use the locally-scoped $ in here as an alias to jQuery.

Also you load multiple times the jQuery library and migrate files and you do a redirect. The site loaded pretty slow for me, so you might want to check/fix the performance as well.

Edited by gentlemedia


Thanks gentlemedia!

I have amended this part. I cannot see anymore errors on firebug however it seems that the code is still not working.

This code was added in order to track certain events on the site such as button clicks ect... and report back to Google Analytics. There is currently no data in analytics.


Thanks Gentlemedia. I have made some research about the error but could not find anything.

I am not sure how I am going to fix this issue.


The reason for that error was my adBlocker was blocking that script, so I don't think that had something to do with your issue. Unless you use also an adBlocker.


Is there a way I can find out what the issue is?

I have tried debugging but I don't think there is anything wrong with the code. Although it still isn't working.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.