I'm trying to to implement visitorapi.js outside of DTM and I'm getting the following error:
VisitorAPI.js:6 Uncaught ReferenceError: Visitor is not defined
at Object.<anonymous> (VisitorAPI.js:6)
at Object.n.3../ChildVisitor (VisitorAPI.js:7)
at r (VisitorAPI.js:1)
at e (VisitorAPI.js:1)
I've copied the code in the implementation guide at the end of the .js file per instructions. Any ideas what could be causing the error?
Is you website deploying DTM for other solutions, or is DTM not deployed on your site at all? Is there a URL that can be shared here so we can view your implementation and the errors in the console?
Also, can you link to the the implementation guide you used?
We're not using DTM at all. Unfortunately, the link is in our QA environment and there's not a good way to access it. I can send the visitorapi.js if that would be helpful. Here's the link to the implementation guide: Implement the Marketing Cloud ID Service for Analytics
Yes, please send me a copy of your VisitorAPI.js file and your AppMeasurement.js file. Also, if you could include a screenshot of the console where you receive this error, that would be helpful.
Try editing your original post. Replies don't allow for attachments, but the original post should allow for it. If that doesn't work, you could always use something like GitHub to host your code and link us to the repo.
Were you able to also supply your AppMeasurement file?
I'd like to verify that Step 5 has been completed and
s.visitor = Visitor.getInstance("INSERT-MARKETING-CLOUD-ORGANIZATION ID-HERE");
Is shown in your AppMeasurement file.