I have seen several things similar, but not exactly on point. Let’s say we have ActiveCampaign “site tracking” enabled. A visitor comes to the site and browses around. At some point they enter their email address in an ActiveCampaign form. At that point, their tracking history, and any UTM data in the URL during their initial referral to the site will be connected to this new Contact that was created when they entered their email address, correct?
OK, now let’s say we have a custom form/survey on the site that is too complicated to create using the ActiveCampaign form builder. But in the process of taking that survey, we ask a visitor for their email. What I want to do is the same as the first scenario, that is, link up the site tracking history and any referral data with this new contact. So: (1) I can use the REST API to make an Ajax call at the point we get the email address, and then server-side check if there is an existing contact and if not, create a new contact. All good there. But … (2) If it’s a new contact, I then want to link the web tracking from this visitor to that new contact I just created server-side. Can I then directly access the ActiveCampaign JavaScript object (I see this referred to as ‘vgo’ or ‘pgo’??) to link those? I have seen this: vgo(‘setEmail’, ‘someemail@email.com’) in another thread. But I am not clear that this can be called once we are on a page, or does it have to get injected into the script as it is loaded on the page – so I would have to stash the email and make sure we loaded a new page at some point? The later is not ideal. I’d rather just be able to call a js function and go on with the survey, since that is all happening via Ajax without a page reload. Thanks for any help!