我的任务是将clevertap 与vuejs 前端集成。但是clevertap是未定义的,我如何在vuejs中声明clevertap?
clevertap.event.push("Product Viewed", {
"Product name":"Casio Chronograph Watch",
"Category":"Mens Accessories",
"Price":59.99,
});
我的任务是将clevertap 与vuejs 前端集成。但是clevertap是未定义的,我如何在vuejs中声明clevertap?
clevertap.event.push("Product Viewed", {
"Product name":"Casio Chronograph Watch",
"Category":"Mens Accessories",
"Price":59.99,
});
您可以将https://github.com/CleverTap/clevertap-web-sdk导入到您的项目中,这将为您提供clevertap 对象,或者将以下脚本添加到您的应用程序的 HTML
<script type="text/javascript">
var clevertap = {event:[], profile:[], account:[], onUserLogin:[], notifications:[], privacy:[]};
// replace with the CLEVERTAP_ACCOUNT_ID with the actual ACCOUNT ID value from your Dashboard -> Settings page
clevertap.account.push({"id": "CLEVERTAP_ACCOUNT_ID"});
clevertap.privacy.push({optOut: false}); //set the flag to true, if the user of the device opts out of sharing their data
clevertap.privacy.push({useIP: false}); //set the flag to true, if the user agrees to share their IP data
(function () {
var wzrk = document.createElement('script');
wzrk.type = 'text/javascript';
wzrk.async = true;
wzrk.src = ('https:' == document.location.protocol ? 'https://d2r1yp2w7bby2u.cloudfront.net' : 'http://static.clevertap.com') + '/js/a.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wzrk, s);
})();
</script>
来源:https ://developer.clevertap.com/docs/web-quickstart-guide
这将在全局范围内创建一个clevertap 对象,您可以在您的vue 应用程序中使用window.clevertap。