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})
Argument | Type | Example | Description |
---|---|---|---|
{field} | String | 'user_id' | The field that you want to set the value for. See the section below for supported fields |
{value} | Any | true | The value to set, supported types and payload vary by field. |
Fields
user_id
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})
Argument | Type | Example | Description |
---|---|---|---|
{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
Key | Type | Example | Description |
---|---|---|---|
type | String | 'user_id' , 'email' , etc | The type of ID. Use user_id for the primary User ID value, all other values will be treated as External IDs |
id | String | '123456789' | A unique ID that identifies this user |
sha256 | String (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 |
scope | String (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_id | String (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
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
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)
cookies_enabled
cookies_enabled
Disables first party cookie usage (enabled by default). When enabled, the Web SDK will write a first party cookie _gsid
to your domain that stores a unique session ID for this user. This is used to join multiple events measured by a single user for multi-touch attribution and anonymous event measurement.
gsght('set', 'cookies_enabled', false)
ga_enabled
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
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
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)
Using 'set' vs. 'init'
You can use 'set' or 'init' to initialize a network integration or ACM. There is no need to use both methods to initialize a single integration!