Identity-Based Attribution

Leveraging player identity for deterministic attribution is crucial for many game developers. This guide will walk you through how to use Gamesight's Web SDK and Measurement API to achieve identity-based attribution seamlessly.


Step 1. Initial Setup

Web SDK

  1. Generate an API Key

Head over to the Management tab on the Gamesight dashboard and choose the In-Game Integration option to generate your API key.

  1. Initialize the Web SDK

Add the JavaScript snippet from Gamesight's Management page (under Game > In-Game Integrations) to your game's landing page. This connects marketing touchpoints with events on your site. Your initialization script should look something like this:

<script>
(function(G,m,s,g,h,t){G.gsght=G.gsght||function(){
(G.gsght.q=G.gsght.q||[]).push(arguments)};G.gsght.q=[],h=m.createElement(s),
t=m.getElementsByTagName(s)[0];h.async=1;h.src=g;t.parentNode.insertBefore(h,t)
})(window,document,'script','https://cdn.gsght.com/sdk.js');

gsght('init', 'GS-XXXXXX');
</script>

Measurement API

Ensure that you have your API key and version ready for event pushes.


Step 2. User Identity Handling

Web SDK

  1. Specify User IDs and External IDs

If your website allows users to log in or create accounts, you should provide these ID values. This ensures accurate reporting and enhanced user journey insights. The user_id value is the primary player identifier used in-game and is not always available on web. However, for publishers with account systems, external_id values allow for deterministic matching between web and in-game activity.

Common External ID values include:

  • Email address
  • Account username
  • Wallet ID

πŸ‘

What about the user_id?

Gamesight understands the complexity of player identity in the PC/console ecosystem. Our platform intelligently handles multiple IDs as inputs at various points in the user journey--even when the user_id isn't available at every point in the user journey.

When you make a link between web and in-game activity using an external ID, Gamesight will update all the anonymous events with that external ID that were sent anonymously (i.e., without a user_id attached).

You can read more about our Late ID Binding process here.

Below is an example of a publisher setting an external ID for a user where the user_id isn't known.

gsght('set', 'user_id', [
  {type: 'email', id: '[email protected]', // External ID for this user
  scope_type:'org', scope_id:'000', // Optionally setting org-scope for this ID (game-scoped by default)
  sha256:'server'},  // Optionally setting hashing behavior of this ID
])

  1. Send Events

Specify the event that occurred during the activity that resulted in the external ID becoming available. This is typically the result of an account registration or login event.

gsght('send', 'account_registration')

Measurement API

For identity mapping, you'll require external IDs along with event data and primary user ID. This is the key connection point where you make the link between the player's user_id and external_id available in in-game and external contexts for deterministic matching

Let's extend the example flow above for the user account data sent from the account_registration event on web. We'll send an in-game login event with the player's relevant org-wide account information.

curl https://api.ingest.marketing.gamesight.io/events \
	-X POST \
	-H 'Authorization: SOMEAPIKEYHERE' \
	-H 'X-Api-Version: 1.1.0' \
	-H 'Content-Type: application/json' \
	-d "$(cat <<-EOF
  {
    "user_id": "b91f8k5r",
    "type": "login",
    "external_ids":[{
      "external_id_type": "email,
      "external_id": "[email protected]",
      "scope_type": "org",
      "scope_id": "000"
    }],
    "identifiers": {...},
  }
EOF)"

Late ID Binding

The anonymous user from a user ID context that registered for an account on web has now been deterministically linked to user ID: b91f8k5r. Gamesight will update all of the previous records of events for that external ID to now include the known user ID for this player. We'll also reprocess attribution for these events using the newly available data to ensure that you're getting the highest quality reporting data possible.


Conclusion

By providing player identity through the Gamesight Web SDK in tandem with the Measurement API, game developers can leverage deterministic attribution for more powerful matching. This identity-based attribution method provides a deep understanding of the user journey from the website to the in-game experience, offering invaluable insights for enhancing marketing efforts and user engagement.