Visitor Tracker

Example Scripts: Visitor Tracker

The example script, Visitor Tracker (VisitorTrackerExample.cs), tracks the number of visitors that visited your experience over the course of a session. Grab the file at the download link at the end of the page.

Instructions

Here is a step-by-step guide to using the script:

  1. Download the script file from the download link at the end of this article.

  2. Follow the instructions provided in Working with scripts to upload the script and add it to an object.

  3. Open the object's Properties panel and go to the Script Settings section.

  4. At the bottom of the object's properties panel is a Script Settings section. Set the parameters according to the Script parameters section of this article.

  5. Once you have finished these steps, your script is ready. Save and build your scene.

  6. If you want to verify if the script is running correctly, visit the built scene.

  7. While visiting the scene, open the Chat app.

  8. In the chat field, type the command that you have set. In this example, /visitors. This prompts the script to run and a message box opens showing a log of all the visitors who have visited the scene.

Script parameters

The parameters for Visitor Tracker

Parameter fieldDescription

OwnerName

If you prefer to have the script listen only to your commands, set the OwnerName to your display name. Otherwise, leave it blank to let anyone issue the command.

VisitorListCommand

The word you would like to use as a command. For this example, let's use "/visitors" as a command.

Notes:

A few notes for the VisitorTrackerExample.cs example script:

  • The script logs the visitors who came and visited your experience.

  • This script only runs until an experience session ends. Once it ends, the tracker resets and all data is lost.

  • An experience session ends when your scene has been empty (no visitors) for some time.

Creative Commons License

Have more questions? Join our Discord!

Last updated