👩‍💻 Add Code

Learn how to add code to your Scene Viewer project.

Now that you are able to embed the Scene Viewer experience generated and hosted through the console, it's time to inject your own scripts into the webpage.

Adding scripts into webAR experiences is only available in the Enterprise plan.

If you'd like to inject your own JavaScript scripts into the webpage, go back to the console and add metadata to add code to the experience. After adding metadata relaunch the experience.

The following keys are words the system uses as pre-defined metadata keys to control built-in animations:

Keyword

Type

Options

Description

webarScript<X>

string

Any string that represents a URL to a remote JavaScript file.

The remote URL of a JavaScript code file that will be injected into the webpage.

webarOnClick

string

Any string that matches a name of an existing function to be called upon click. The function must be followed by brackets (), either empty or with arguments.

Runs a specific function when clicking the webpage.

For example:

Key

Value

webScript1

https://code.jquery.com/jquery-3.5.0.js

webScript2

https://www.company.me/path-to-javascript-file.js

webarOnClick

createCache()

Remember to relaunch the experience after adding metadata with Scene Viewer experiences for the changed to take effect.