Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript integration is not working on 0.8.1 version #4

Open
vershasaxena91 opened this issue Jul 20, 2023 · 0 comments
Open

Javascript integration is not working on 0.8.1 version #4

vershasaxena91 opened this issue Jul 20, 2023 · 0 comments
Assignees

Comments

@vershasaxena91
Copy link

I am using javascript in local web page header but getting a below error in the console:
Uncaught (in promise) ReferenceError: config is not defined
at liliput.js:6320:25
at l (liliput.js:130:40)
at t._invoke (liliput.js:360:22)
at Generator.next (liliput.js:185:21)
at f (liliput.js:6112:99)
at o (liliput.js:6114:194)
at liliput.js:6114:364
at new Promise ()
at liliput.js:6114:97
at liliput.js:6432:20
(anonymous) @ liliput.js:6320
l @ liliput.js:130
t._invoke @ liliput.js:360
(anonymous) @ liliput.js:185
f @ liliput.js:6112
o @ liliput.js:6114
(anonymous) @ liliput.js:6114
(anonymous) @ liliput.js:6114
(anonymous) @ liliput.js:6432
(anonymous) @ liliput.js:6805
l @ liliput.js:130
t._invoke @ liliput.js:360
(anonymous) @ liliput.js:185
f @ liliput.js:6112
o @ liliput.js:6114
(anonymous) @ liliput.js:6114
(anonymous) @ liliput.js:6114
(anonymous) @ liliput.js:6859
(anonymous) @ liliput.js:2525
l @ liliput.js:130
t._invoke @ liliput.js:360
(anonymous) @ liliput.js:185
c @ liliput.js:822
o @ liliput.js:844
Promise.then (async)
c @ liliput.js:832
o @ liliput.js:844
(anonymous) @ liliput.js:851
(anonymous) @ liliput.js:840
(anonymous) @ liliput.js:3054
(anonymous) @ liliput.js:3142
(anonymous) @ liliput.js:4545
Be.C.dispatch @ liliput.js:4631
(anonymous) @ liliput.js:4044
(anonymous) @ liliput.js:4043
l @ liliput.js:130
t._invoke @ liliput.js:360
(anonymous) @ liliput.js:185
c @ liliput.js:822
o @ liliput.js:844
(anonymous) @ liliput.js:851
(anonymous) @ liliput.js:840
Be.A.track @ liliput.js:4063
i @ web_page.html:5
(anonymous) @ web_page.html:5
load (async)
(anonymous) @ web_page.html:5
i @ web_page.html:5

Please help me how to use javascript for integration?
This is my web page:

<script>
!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).tracardi=t()}(function(){return function n(o,i,a){function c(e,t){if(!i[e]){if(!o[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(d)return d(e,!0);throw(r=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",r}r=i[e]={exports:{}},o[e][0].call(r.exports,function(t){return c(o[e][1][t]||t)},r,r.exports,n,o,i,a)}return i[e].exports}for(var d="function"==typeof require&&require,t=0;t<a.length;t++)c(a[t]);return c}({1:[function(t,e,r){"use strict";!function(t){t=t||window;var r=[],n=!1,o=!1;function i(){if(!n){n=!0;for(var t=0;t<r.length;t++)r[t].fn.call(window,r[t].ctx);r=[]}}function a(){"complete"===document.readyState&&i()}t.documentReady=function(t,e){if("function"!=typeof t)throw new TypeError("callback for documentReady(fn) must be a function");n?setTimeout(function(){t(e)},1):(r.push({fn:t,ctx:e}),"complete"===document.readyState||!document.attachEvent&&"interactive"===document.readyState?setTimeout(i,1):o||(document.addEventListener?(document.addEventListener("DOMContentLoaded",i,!1),window.addEventListener("load",i,!1)):(document.attachEvent("onreadystatechange",a),window.attachEvent("onload",i)),o=!0))}}(window);var n=[];window.tracker||(window.tracker={}),window.response||(window.response={context:{}}),window.onTracardiReady={bind:function(t){"function"==typeof t&&n.push(t)},call:function(e){n.forEach(function(t){t(e)})}},function(){for(var r=[],n="liliput.min.js",t=["track"],e=0;e<t.length;e++){var o=t[e];window.tracker[o]=function(e){return function(){var t=Array.prototype.slice.call(arguments);return t.unshift(e),r.push(t),window.tracker}}(o)}function i(){if(console.debug("[Tracker] Rerun callbacks."),void 0!==window.tracardi.default)if(window.tracardi.default.getState().plugins.tracardi.initialized)for(window.tracker=window.tracardi.default;0<r.length;){var t=r.shift(),e=t.shift();tracker[e]&&tracker[e].apply(tracker,t)}else console.error("[Tracardi] Callbacks stopped. Tracker not initialized.");else console.error("[Tracardi] Callbacks stopped. Tracker not initialized. Is script url correct?")}documentReady(function(){var t,e,r;"1"!==navigator.doNotTrack||!0!==(null===(t=options)||void 0===t||null===(e=t.tracker)||void 0===e||null===(r=e.settings)||void 0===r?void 0:r.respectDoNotTrack)?((e=document.createElement("script")).type="text/javascript",e.async=!0,void 0!==options.tracker||void 0!==options.tracker.url||void 0!==options.tracker.url.script?(null!==options.tracker.url.script?options.tracker.url.script.startsWith("http")||options.tracker.url.script.startsWith("//")?e.src=options.tracker.url.script+"/"+n:e.src=options.tracker.url.script:e.src=n,console.debug("[Tracker] Loading: "+e.src),e.addEventListener?e.addEventListener("load",function(t){i()},!1):e.onreadystatechange=function(){"complete"!==this.readyState&&"loaded"!==this.readyState||i(window.event)},(r=document.getElementsByTagName("script")[0]).parentNode.insertBefore(e,r)):console.error("[Tracker] Undefined options.tracker.url.script. This url defines location of tracker code.")):console.log("We are respecting do not track setting. Tracardi disabled.")})}()},{}]},{},[1])(1)});

var options = {
    tracker: {
        url: {
            // This is url to tracardi backend. Please mind the correct port.
            script: 'dist/liliput.min.js',
            api: 'http://127.0.0.1:8686'
        },
        source: {
            id: "65a550d4-ee3a-4a01-9d1f-0c9839ae6ed5"
        }
        // Please see the documentation for more settings: http://docs.tracardi.com/integration/js-integration/
    }
}
</script> ​

My First Heading

My first paragraph.

​<script> window.response.context.profile = true; window.tracker.track("test", {"firstname": "abc"}); console.log("successfully load"); </script> ​
@atompie atompie self-assigned this Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants