APIs & Integrations

MLilien
Member

Creating a Contact From JavaScript Tracking Code

SOLVE

Hi!

I manage multiple Hubspot workspaces. I have two separate apps connected to two separate workspaces and they both run the same Javascript to `identify` and `trackPageView`. In one of the workspaces, a new contact is created with this code (the desired behavior). In the other, the same code does not create a new contact.

 

The JavaScript being run is:

_hsq = window._hsq = window._hsq || [];                                                      
_hsq.push(["identify", {email: email, first_name: name}]);               
_hsq.push(['trackPageView']); 

 

I've verified that we're using the correct source url when including the JavaScript library and have also checked Chrome's network inspector to confirm that the `trackPageView` command is making a network request to Hubspot with the correct data.


Is there a setting somewhere that determines whether a contact is created or some setting that I should compare between the two workspaces to see what's different?
Thanks!

0 Upvotes
1 Accepted solution
sylvain_tirreau
Solution
Top Contributor

Creating a Contact From JavaScript Tracking Code

SOLVE

Hi,

 

1) Do you have the correct portal on each site for each tracking code (the XXXXX in the code below)?

<!-- Start of HubSpot Embed Code -->
<script type="text/javascript" id="hs-script-loader" async defer src="//js-eu1.hs-scripts.com/XXXXX.js"></script>
<!-- End of HubSpot Embed Code -->

See settings > Tracking & Analitycs > Tracking code for each portal.

 

2) Check your privacy policy (Settings > Privacy and consent): if you have a consent banner on one site and the user has not accepted the consent, the contact will not be created. You must have the same settings at this level on both portals.

 

3) Check in Settings > Tracking & analytics > Tracking code > Advanced tracking if you have the same settings and if there is no IP exclusion on one of the portals.

 

Are these initial checks producing results?

View solution in original post

3 Replies 3
sylvain_tirreau
Solution
Top Contributor

Creating a Contact From JavaScript Tracking Code

SOLVE

Hi,

 

1) Do you have the correct portal on each site for each tracking code (the XXXXX in the code below)?

<!-- Start of HubSpot Embed Code -->
<script type="text/javascript" id="hs-script-loader" async defer src="//js-eu1.hs-scripts.com/XXXXX.js"></script>
<!-- End of HubSpot Embed Code -->

See settings > Tracking & Analitycs > Tracking code for each portal.

 

2) Check your privacy policy (Settings > Privacy and consent): if you have a consent banner on one site and the user has not accepted the consent, the contact will not be created. You must have the same settings at this level on both portals.

 

3) Check in Settings > Tracking & analytics > Tracking code > Advanced tracking if you have the same settings and if there is no IP exclusion on one of the portals.

 

Are these initial checks producing results?

BérangèreL
Community Manager
Community Manager

Creating a Contact From JavaScript Tracking Code

SOLVE

Hi @MLilien and welcome, it's a pleasure to have you here!

Thanks for asking the HubSpot Community!

I'd love to put you in touch with our Top Experts: Hi @stefen, @Indra and @Anton do you have suggestions to help @MLilien, please?

Have a lovely day and thanks so much in advance for your valuable contributions!
Bérangère


HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
Learn More.


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres! !
0 Upvotes
BérangèreL
Community Manager
Community Manager

Creating a Contact From JavaScript Tracking Code

SOLVE

Hi @MLilien, just checking on you, do you still need help?

I have found for you this similar thread that you might want to take a look at "How to create new Contacts via Tracking API, but limit to certain pages?".

If you still need a hand, let's check with our Top Experts: Hi @sylvain_tirreau, @Teun and @Bortami, do you have tips to share with @MLilien, please?

Have a great day and thanks so much in advance for your help!
Bérangère


HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
Learn More.


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres! !
0 Upvotes