I try to put the track code in index.html
and seems referenced.
but when i submit from and create data to hubspot via hubspot api.
it cannot get any tracking record.
may i know how to correctly use hubspot track code with Vue.js?
Hi @W50, The HubSpot tracking code works by inserting a small snippet of JavaScript onto your webpage. This code is used to track visitor behavior and interactions on your website.
If you are using Vue.js, you can add the tracking code to the <head> section of your HTML.
Here is an example of how to do this:
<head>
<!-- HubSpot Tracking Code -->
<script type=“text/javascript” id=“hs-script-loader” async defer src=“//js.hs-scripts.com/XXXXXX.js”></script>
<!-- End HubSpot Tracking Code -->
</head>
Replace the “XXXXXX” with your HubSpot tracking code.
Once the tracking code has been added, HubSpot will begin tracking visitor behavior and interactions on your website.
If you need to learn more about how to track your website and use HubSpot’s tracking code, you can refer to this guide: Set up site tracking in HubSpot
Hope this helps! ![]()
Thanks,
I already add the tracking code in <head>
but I think maybe i was ask wrong question.
I build a form on my Vue.js App and use webapi to create hubspot contact,
even though I added the tracking code in the page, my contact data always
record [This contact was created from Offline Sources from Integration].

seems, if I use hubspot api to create contact data.
tracking code doesn’t work because server side api cannot use cookie.
but dose any way can let me record some data on this property?
Any solution for this ? I am also facing the same issue