- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
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; } }
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 !
07-02-2020 09:45 AM
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.
Based on your code snippet, it looks like you want to leverage jQuery. Here is the documentation on that extension:
It contains great code examples and at the bottom breaks down how the jQuery code looks within utag.js
Also, I noticed a typo in your code sample, that may be the issue as well:
Hope this helps!
07-08-2020 08:34 AM
Copyright All Rights Reserved © 2008-2023