The set method provides an interface to control values that will be used this Web SDK instance. This commonly includes actions like setting User ID values and configuring which integrations are enabled.

gsght('set', '{field}', {value})
ArgumentTypeExampleDescription
{field}String'user_id'The field that you want to set the value for. See the section below for supported fields
{value}AnytrueThe value to set, supported types and payload vary by field.

Fields

user_id

Sets the user_id associated with the current instance of the Web SDK. Not that this can be used both for setting the primary ID for a user as well as any additional External IDs that you may want to set on the session.

See Web Measurement SDK Quick Start to more details about how to work with User ID values.

gsght('set', 'user_id', {value})
ArgumentTypeExampleDescription
{value}UserPayload or UserPayload[]{type: 'user_id', id: '1234'}Either a single UserPayload object or an array of UserPayload objects

UserPayload

Below is a description of each of fields that are supported in the UserPayload object

KeyTypeExampleDescription
typeString'user_id', 'email', etcThe type of ID. Use user_id for the primary User ID value, all other values will be treated as External IDs
idString'123456789'A unique ID that identifies this user
sha256String (optional)null (default)Control the data hashing used for storing this ID:
- null: hashing disabled
- client: the provided ID is already hashed
- server: Gamesight server hashes the ID before storage
scopeString (optional)'game' (default)Used to manage this id's scope:
- game: This ID is scoped for usage by this game only
- org: This ID is available for matching between all games in this Org.
scope_idString (optional)'123'Provide the organization that this ID is scoped to.

📘

User ID Scopes

You can use different scopes to control the availability of a specific ID between multiple titles within your Org on Gamesight. This can be valuable if you have a shared account system between titles and would like to share the device graph that is generated from campaigns you are running on Title A to also be usable by Title B.

Please contact your Customer Success Manager if you would like to utilize Org scoped IDs and our team can help validate your use case and implementation.

Examples

Below are some examples of using the Web SDK to set a User ID value.

// Simple ID
gsght('set', 'user_id', {
  type: 'user_id',
  id: '123456789'
})

// Attaching a hashed email org-wide
gsght('set', 'user_id', {
  type: 'email',
  id: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08',
  scope: 'org',
  scope_id: '1234',
  sha256: 'client'
})

// Set multiple IDs in a single call
gsght('set', 'user_id', [
  {type: 'user_id', id: '123456789'},
  {type: 'gaid', id: '0af42fd4-eeda-4710-9272-8de9f668cd99'},
])

root_domain

Change the domain that the Web SDK makes requests to. By default requests are sent to https://gsght.com. If you have a custom domain configured for your Game you should use this feature to set the appropriate tracking domain.

gsght('set', 'root_domain', 'https://l.mygame.com')

warnings

Enables debug warnings (disabled by default). When enabled, commands will log warning to the console if they receive incorrectly formatted or incomplete options. This setting can be helpful during development.

gsght('set', 'warnings', true)

ga_enabled

Enables the Google Analytics integration (disabled by default). When enabled, the Web SDK automatically detects Google Analytics tags installed on the web page and attaches the GA Client ID value as an External ID to the Web SDK instance. This allows for hits to be sent to your GA account server-to-server.

See the Google Analytics integration guide for more details.

gsght('set', 'ga_enabled', true)

fb_enabled

Enables the Facebook Ads integration (disabled by default). When enabled, the Web SDK automatically detects Meta Pixel tags installed on the web page and synchronizes ID values (fbc, fbp, and external_id) between your Facebook Pixel and Gamesight. This allows for events to be sent to your Meta Pixel through the Conversions API more reliably.

See the Facebook Ads integration guide for more details.

gsght('set', 'fb_enabled', true)

acm_enabled

Enables the Automatic Click Measurement integration (disabled by default). When enabled, the Web SDK automatically collects UTM parameters and Referrer data from your webpage. This allows for reporting and attribution even when Gamesight Trackers are not used.

See the Automatic Click Measurement guide for more details.

gsght('set', 'acm_enabled', true)