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.
Here is a step-by-step guide to using the script:
- Download the script file from the download link at the end of this article.
- Follow the instructions provided in Working with scripts to upload the script and add it to an object.
- Open the object's Properties panel and go to the Script Settings section.
- 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.
- Once you have finished these steps, your script is ready. Save and build your scene.
- If you want to verify if the script is running correctly, visit the built scene.
- While visiting the scene, open the Chat app.
- 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.
|The parameters for Visitor Tracker|
|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.|
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
This content is licensed under the terms of the Creative Commons Attribution 4.0 International License. When using this content, you must:
- Acknowledge that the content is from the Sansar Knowledge Base.
- Include our copyright notice: "© 2017 Linden Research, Inc."
- Indicate that the content is licensed under the Creative Commons Attribution-Share Alike 4.0 International License.
Include the URL for, or link to, the license summary at https://creativecommons.org/licenses/by-sa/4.0/deed.hi (and, if possible, to the complete license terms at https://creativecommons.org/licenses/by-sa/4.0/legalcode.
"This work uses content from the Sansar Knowledge Base. © 2017 Linden Research, Inc. Licensed under the Creative Commons Attribution 4.0 International License (license summary available at https://creativecommons.org/licenses/by/4.0/ and complete license terms available at https://creativecommons.org/licenses/by/4.0/legalcode)."