How do you create a new visitor through the API?

Comments

4 comments

  • Avatar
    Greg Nutt

    Hey Daniel - new visitors in Pendo are created by the Raw Events that we capture behind the scenes.  There is no way via the standard endpoints to create a Visitor in the same way that you would review their analytics.

    That said, the Track Events API endpoint does require you to specify a Visitor ID and so this may be a way to manually create a Visitor ID, if this is your desire.  If I may ask, however, what is your use case for creating a Visitor ID manually within your subscription, rather than waiting for utilization to come across to generate the creation of a new Visitor?

    0
    Comment actions Permalink
  • Avatar
    Daniel Jones

    I tried to use the Track Events API but could not figure out how to get it to create a user from it... maybe i was sending bad data or something, but the only reply i would get back was:

    {"overall":{},"fields":{"event":"Required","timestamp":"Required","type":"Required","visitorId":"Required"}}

    The reason for creating it is because we track logged in users - when a user signs up they create and account and payment at the same time - so when we capture the payment I am trying to send Trial Start date to the user, but this is in the backend before the frontend javascript has loaded to create the first event of the user.  So sending the Trial info has no record to attach to.  If I can create the visitor and assign the Trial info, then after the page loads it can fill in the rest of the details. 

    0
    Comment actions Permalink
  • Avatar
    Angela Holly

    Daniel Jones, you can use these endpoints to create visitors or accounts via the API. 

    To create a visitor ID:
    POST https://app.pendo.io/api/v1/metadata/visitor/custom/value?create=true

    To create an account ID: 
    POST https://app.pendo.io/api/v1/metadata/account/custom/value?create=true

    Follow the format of the examples under https://help.pendo.io/resources/support-library/api/index.html?bash#set-value-for-a-set-of-agent-or-custom-fields

    Here are a few things to keep in mind: 

    • Consider if it's necessary to create the visitors/accounts in advance of their first use of the application. Usually the answer is no. 
    • When the visitor/account is created in Pendo, this will set their 'First Visit' date and this can't be updated.
    • Just creating the accounts and visitors via API won't result in them appearing under Pendo > People > Visitors or Pendo > People > Accounts since they won't have any events. You'll be able to find the visitors or accounts if you search for them in the search bar because they will exist in the subscription, but they won't appear in any of the main dashboards/analytics pages until they have events associated with them.
    0
    Comment actions Permalink
  • Avatar
    Angela Holly

    Daniel Jones, I realize I didn't fully respond to your previous comment. Sorry about that!

    It is possible to create new visitors via a track event (server side) in Pendo. Just make sure you are supplying all required fields & following the formatting requirements in this article: https://support.pendo.io/hc/en-us/articles/360032294291-Track-Events-Configuration#ServerSide

    A few extra things to note:

    1. If the visitor ID/account ID sent in the track event do not already exist in Pendo, that record will be created. The first visit date will also be set to when Pendo received the event.
    2. It's important to go to Settings > Subscription Settings > View App Details and review the setting "Count Track Events Received For A Visitor As Time In Application".  This impacts how Pendo treats the visitor/account and their events if only track events are sent (no other application usage) for them. 
    • If this checkbox is ENABLED: The newly created visitor/account will appear in Pendo tables/reports/ dashboards and the track event(s) for that visitor/account will count towards time on application
    • If this checkbox is DISABLED: If The newly created visitor/account WILL NOT appear in Pendo tables/reports/ dashboards and the track event(s) for that visitor/account WILL NOT count towards time on application. The visitor/account record will still exist in Pendo and be searchable. 

      Please note this setting is NOT retroactive and won't impact track events that Pendo has already received, but it will apply going forward. Additionally, this applies to ALL track events. 
    0
    Comment actions Permalink

Please sign in to leave a comment.