UNPKG

@unifygtm/intent-client

Version:

JavaScript client for interacting with the Unify Intent API in the browser.

78 lines (75 loc) 2.34 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <script> !(function () { var e = [ 'identify', 'page', 'track', 'startAutoIdentify', 'stopAutoIdentify', 'startAutoPage', 'stopAutoPage', 'startAutoTrack', 'stopAutoTrack', ]; function t(o) { return Object.assign( [], e.reduce(function (r, n) { return ( (r[n] = function () { return o.push([n, [].slice.call(arguments)]), o; }), r ); }, {}), ); } window.unify || (window.unify = t(window.unify)), window.unifyBrowser || (window.unifyBrowser = t(window.unifyBrowser)); var n = document.createElement('script'); (n.async = !0), n.setAttribute('src', 'dist/js/browser/index.min.js'), n.setAttribute( 'data-api-key', 'wk_5fTtsDLJ_7vx9DsjPcr79yk4FweES727w59pxS8EJ', ), n.setAttribute('id', 'unifytag'), (document.body || document.head).appendChild(n); })(); </script> </head> <body> <noscript>You need to enable JavaScript to run this app.</noscript> <div id="root"> <div style="display: flex; align-items: center; gap: 16px"> <!-- Legacy track data attrs --> <button data-unify-track-clicks>Legacy track</button> <button data-unify-track-clicks data-unify-attr-custom="test"> Legacy track custom attrs </button> <button data-unify-track-clicks data-unify-label="Custom Button Name"> Legacy track custom label </button> <!-- Current track data attrs --> <button data-unify-click-event-name="Test Button Clicked">Track</button> <button data-unify-click-event-name="Test Button Clicked" data-unify-event-prop-custom="test" > Track custom attrs </button> <button data-unify-click-event-name="Test Button Clicked" data-unify-label="Custom Button Name" > Track custom label </button> <button>Should not track</button> </div> </div> </body> </html>