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:
- In the My Experiences app, choose the scene you want to edit and click the Edit Scene button.
- If you already have the file in your inventory, jump to step 3 to start using the script. Otherwise, download the VisitorTrackerExample.cs example script at the bottom of this page and upload the file into your inventory. See Uploading and Applying Scripts for more information.
- Now that you have the script in your inventory, choose an object in the scene that you want to apply the script to.
- Select the VisitorTrackerExample.cs file from your Inventory and drag the script onto the object in the scene. Alternatively, you can add the script to an object via the Scene Objects panel.
- Now that the script has been applied on the object, open the properties panel for the object. At the bottom of the object's properties panel is a Script Settings section.
Note: Alternatively, you can also access the Script Settings section from the object's dropdown hierarchy on the Scene Objects panel. Right-click on the script component to access the script properties panel. The parameters for Visitor Tracker
- 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.
- Next, set the command word to trigger the script. In the VisitorListCommand field, type the word you would like to use as a command. For example, let's use "/visitors" as a command.
- 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.
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)."
Example Script File: