Highlighted

I can't see to fire Pixels in a Button

Rookie Contributor

Hi team,

Could you help me please? ... I have one button "Cotizar" with follow structure: <input type="submit" value="Cotizar" class="wpcf7-form-control wpcf7-submit"> I made that:

/* Replicate this _target block for each new set of URLS you want to match with a "Contains" logic */
/* using 'contains' and 'adt.com' will match both www.adt.com as well as www.adt.com/somePath/someFile.html */
/* using 'exact' and 'adt.com' will match ONLY adt.com, NOT http://adt.com/ or any other strings. You must match exactly the value of document.location.href (test this in your console to confirm) */
_target('contains', ['auteco.com.co', 'somedomain.com', 'anotherdomain.com'], function() {
  jQuery('input.wpcf7-submint').on('click', function() {
    window.lbReload('button_click_wpcf7-submint', '', '', '');
  });
});
_target('exact', ['http://www.another-domain.com/'], function() {
  jQuery('.totop').on('click', function() {
    window.lbReload('button_click', '', '', '');
  });
});
/* ========================================== */
/* ====== DO NOT EDIT BELOW THIS LINE ======= */
function _target(_mode, _target_urls, callback) {
  if (!!_mode) {
    _currentURL = document.location.href;
    var _test = _target_urls.some(function(v) {
      if (_mode == "contains") {
        return _currentURL.indexOf(v) >= 0;
      } else if (_mode == "exact") {
        return _currentURL == v;
      }
    });
    if (!!_test) callback();
  } else {
    return false;
  }
}

1.PNG

But I don't know, what's my mistake, because I checked the landing and loads the pixels and it doesn't fire.

 

Thanks so much in advance !

Systems Engineer. for the experience acquired, with the capacity for analysis (qualitative and quantitative information), investigative, creative, disciplined, empathetic, assertive and with a vision of innovation in the personal, work and professional fields.
1 REPLY 1
Highlighted

I can't see to fire Pixels in a Button

Tealium Employee

Hi @DDZS2020 

If you want to track a button click, there are generally two options.  

 

1. Within your source code.

2. Within TiQ using a jQuery or Javascript Extension.

  • you can leverage a jQuery Extension or javascript Extension to place a tracking call within TiQ.  

Based on your code snippet, it looks like you want to leverage jQuery.  Here is the documentation on that extension:

https://community.tealiumiq.com/t5/iQ-Tag-Management/jQuery-onHandler-Extension-jQuery-1-7-and-up/ta...

It contains great code examples and at the bottom breaks down how the jQuery code looks within utag.js

jQuery onHandler Extension (jQuery 1.7 and up) - Tealium Learning Center 2020-07-02 09-42-43.pngAlso, I noticed a typo in your code sample, that may be the issue as well:

Reply to Message - Tealium Learning Center 2020-07-02 09-44-10.pngHope this helps!