Expand my Community achievements bar.

I'm getting a Visitor is not defined error in visitorapi.js

Avatar

Level 1

Hi,

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)

    at 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?

9 Replies

Avatar

Level 10

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?

Thanks,
Jantzen

Avatar

Level 1

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

Avatar

Level 10

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.

Thanks,
Jantzen

Avatar

Level 10

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.

Avatar

Level 10

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.

Avatar

Level 1

We use Tealium as our TMS and the consultant who implemented Tealium put in a s_doPlugins extension. 

Here's a copy of the extension: visitorapi/s_doplugin.txt at master · andyma1991/visitorapi · GitHub

Avatar

Level 10

Looking at the GitHub repo you posted, I don't see where the consultant implemented the following instructions:

Implement the Experience Cloud ID Service for Analytics