CS2 3D Viewer Iframe Examples
Embed an interactive CS2 skin from a Steam inspect link, choose how the viewer opens, and keep your item page in sync as visitors change skins or loadouts.
See the embed exampleEmbed a skin from its link
Create a public viewer key in Dashboard → CS2 3D View. In the cs2screen panel, add your site under Websites allowed to embed and enable the features you want to use.
Add the iframe below and call showSkin() with the full Steam inspect link for the selected item. URLSearchParams encodes the link for you. Call the function again to open another item in the same frame.
JavaScript
function showSkin(inspectLink) {
const viewer = new URL('https://3d.cs2screen.com/');
viewer.searchParams.set('key', 'pk_YOUR_VIEWER_KEY');
viewer.searchParams.set('inspectlink', inspectLink);
viewer.searchParams.set('embed', '1');
document.getElementById('skin-viewer').src = viewer.href;
}
HTML for the iframe
<iframe id="skin-viewer" title="CS2 skin preview"
width="100%" height="480" allow="fullscreen"></iframe>
For the account, panel and domain setup, see the viewer setup guide.
Set the starting view
Set these options as query parameters on the iframe URL, just as you set inspectlink. The viewer uses the permissions and defaults configured on your key.
- Exact item or configured skin
- Use
inspectlinkfor a specific Steam item. For a preset without an inspect link, passweaponandpaint. Setseedandwearto start with a particular pattern and float. Presets can usestattrak=1orsouvenir=1. - First-person loadout
- Use
mode=arenaormode=inspectto open Arena when supported. Setagent,glovesorholdfor the starting loadout. Choose whether the loadout tiles or sound start enabled withtilesandsound. - Customize, Catalog and language
- Pass
customize=1to open the customization controls once the skin loads, orcatalog=1to start in the Catalog. Enable the corresponding feature on your viewer key. Setlangto match your page. - Share a view on your site
- Set
shareto the allowed URL of your item page. The viewer adds the item and loadout parameters to the shared URL. Forward those parameters to the iframe when the page opens to restore the same view.
Read what the viewer shows
Listen for cs2viewer:change to update the skin name, float, seed, Doppler phase or Arena loadout on your page. Each event includes the full state. Add your website to the key's allowed origins in the panel for event delivery.
cs2viewer:ready can arrive before an item loads. Use cs2viewer:loading for a busy state and cs2viewer:error to clear it if a new item fails to load. The previous item stays visible.
Keep the listing's original inspect link if you need its stickers or charms. A Catalog or Customize selection can emit a generated link, indicated by item.syntheticLink.
With the iframe above, add an element with id="viewer-item-name" to display the current skin's market name.
JavaScript
const frame = document.getElementById('skin-viewer');
const origin = 'https://3d.cs2screen.com';
const itemName = document.getElementById('viewer-item-name');
window.addEventListener('message', (event) => {
if (event.origin !== origin ||
event.source !== frame.contentWindow) return;
const message = event.data;
if (message?.version !== 1) return;
if (message.type === 'cs2viewer:change') {
itemName.textContent = message.item.marketHashName;
} else if (message.type === 'cs2viewer:ready' && message.state) {
itemName.textContent = message.state.item.marketHashName;
}
});
If your listener starts after the frame has loaded, send { type: 'cs2viewer:get-state' } to frame.contentWindow with the same origin as the target. The viewer replies with the current state when an item is shown.
Show the exact item
Marketplaces
Let buyers rotate a listing's skin and inspect its pattern, wear and applied stickers.
Inventory apps
Open the viewer when a user selects an inventory item and pass that item's inspect link.
Trading tools
Show each item in a trade's detail view so users can examine the skin before making an offer.
Keys, access and usage
Which key goes in the iframe?
Use a public viewer key that starts with pk_. The SteamWebAPI data API key and the cs2screen panel password stay out of the browser embed.
Which plans include the viewer?
It is included in active SteamWebAPI plans except Free and Free+. Viewer traffic does not consume SteamWebAPI API credits. See custom branding terms.
Can I return an image instead?
For a still image on a listing card, use the CS2 Screenshot API. Use the iframe on the detail page when users need to rotate the item.
Get a viewer key
Find your viewer keys in Dashboard → CS2 3D View.