dominikmatt / trackingJS

A simple google Analytics Tracking Plugin
Apache License 2.0
4 stars 6 forks source link

check if link always have a tracking-event #53

Closed dmetzler1988 closed 6 years ago

dmetzler1988 commented 8 years ago

please add to the linkHandler in linkBundle.js the following line to check if the link have a own tracking-definition (if (!$el.data('trackingjs')) {)

...
    var linkHandler = function(event) {
        var $el = $(event.currentTarget),
            href = $el.attr('href'),
            target = $el.attr('target'),
            external = new RegExp('^((f|ht)tps?:)?//(?!' + location.host + ')');

        // check if link always have a tracking-definition
        if (!$el.data('trackingjs')) {
            // phone
            if(/tel:/.test(href)) {
                this.tracking.event(
...