Configurations
The Configurations tab captures configuration information whenever a user hits the "Share" button within the player. While the share button in the player captures the present configuration, the Configurations API can be leveraged to capture the configuration based on any other event, such as adding to cart.
Configuration Details
Once the Share button is pressed, a record is created with the Configurations tab.
Each record retains the relevant configuration information.
In the Threekit platform, you can save your configuration for later retrieval. Here are examples of how to save a configuration as well as how to retrieve a save so the user sees a pre-set configuration load in the player by default, instead of starting from scratch.
Save a Configuration:
To be able to load a saved configuration we first need to create and save a configuration in the platform.
There are two ways to save a configuration: 1) click the Share Button on the player 2) call the configuration API
Share Button
First, you need to have this button available on the player so it can be clicked. Go to Settings -> Player Settings -> check the box in front of “Share Button” in the Embedded Player Elements section.
When this checkbox is turned on, you will be able to see the Share button on the player like this (highlighted in the screenshot below):
Clicking on the Share button will save the current configuration, and a link to the saved configuration will be generated - you can choose to copy the link or share via email or other social media. In the link there is a parameter “tkcsid=xyzabc123” appended to the end. This “tkcsid” is the shortId of this saved configuration. With this short id we will be able to retrieve this configuration. We will talk more about this in the Use a Saved Configuration section.
Saving a Configuration via an API call
What if you don’t want the share button to appear on the player? The Share button generates a link to load the Threekit player on the page of the user clicking the button. If the Player is behind a login, this generated share link will not work for users who can’t login to the system. In such a case, you may wish to save a configuration to store the ShortId and later access the configuration in a publicly-available Threekit Player.
This code snippet below defines a saveConfiguration() function that saves the current configuration to Threekit by doing an API call. You can then parse the response of the API call and get the id or shortId of the saved configuration. Then use that saved configuration Id as desired. See the Use a Saved Configuration section for an example snippet of code for a web page loading an existing configuration.
Use a Saved Configuration:
Where to find the saved configurations
Now we have a configuration saved in the Threekit Platform, but where can we find it? Saved configurations are found under Orders -> Configurations. A list of all saved configurations are shown here.
Clicking into a saved configuration you will be able to see the details. The Configuration UUID or Configuration Short ID is the data we need to locate the configuration.
Load the player with a saved configuration
The example below shows HTML and JavaScript code that loads the player in the page with a previously saved configuration whose shortId is "PegDan0Zx".
Additionally, there is the function saveConfiguration() created as an example of saving a configuration. So when a user starts from the saved configuration and makes some tweaks then wants to save that new configuration, the saveConfiguration() can be called and a new id, as well as a new shortId will be generated. Some detailed explanations can be found in the comments within the code.
Last updated