JSFiddle - React, Tailwind, and code Playground

by hslincoln

HTML

<!-- Changes to put into the icat main pages to track the click throughs -->

JavaScript

// define catchment for the banners within the template


jQuery(function iCatGaFunction() {
    jQuery('#catbanner').click(function () {
        var url = jQuery(location).attr('href'); // get the current url
        var iCat = url.substring(url.lastIndexOf('/') + 1); // Last index of the url icat reference 
        _gaq.push(['_setCustomVar', 1, 'iCatBanner', iCat]); // custom script to append to a onclick method
    });
});

jQuery('#catbanner').find('a:first').attr('onClick', 'iCatGaFunction()'); // wrap first a href around <img> and call function onclick