Created
December 5, 2014 19:48
-
-
Save cesarandreu/c1e91266c1bfc3ddd233 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(n,c){ | |
| if (c[n] === void 0) { | |
| c[n] = function () { | |
| c[n].clients.push(this); | |
| this._init = [Array.prototype.slice.call(arguments)]; | |
| }; | |
| c[n].clients = []; | |
| var action = function(method){ | |
| return function () { | |
| this['_'+method] = this['_'+method] || []; | |
| this['_'+method].push(Array.prototype.slice.call(arguments)); | |
| return this; | |
| }; | |
| }; | |
| var methods = ['addRecord', 'set', 'trackEvent', 'trackPageview', 'ready']; | |
| for (var i = 0; i < methods.length; i++){ | |
| var method = methods[i]; | |
| c[n].prototype[method] = action(method); | |
| } | |
| var s = document.createElement('script'); | |
| s.type = 'text/javascript'; | |
| s.async = !0; | |
| s.src = ('https:' === document.location.protocol ? 'https:' : 'http:') + '//s3.amazonaws.com/td-cdn/sdk/td-1.2.0.js'; | |
| var t = document.getElementsByTagName('script')[0]; | |
| t.parentNode.insertBefore(s,t); | |
| } | |
| })('Treasure', window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment