Gamitee customer API

Gamitee customer API

As Gamitee's script is loaded, it has all the information that the plugin needs in order to function properly and to be configured as it was requested by the customer.

Sometimes some data is not available when the main script is loaded. To solve this issue, we have created the customer API.

Getting the customer API object

There are 2 ways to get the customer API object from the gamitee script.

  1. Adding the callback parameter.
  2. When loading gamitee's script, a callback parameter can be added.

    <script src="https://cdn.gamitee.io/javascripts/dist/en.bundle.js?callback=yourFunction"></script>

    After loading Gamitee, the script will be looking for the callback function on the window object and will execute it, providing the GamiteeCustomerAPI object to that function.

  3. Using the global object.
  4. If the callback parameter is not provided, a global object with the name `gamiteeCustomerApi` will be set on the global window object.

    ⚠️

    Please note: providing a callback will avoid setting the global API object. If you provide the callback but still need this object as a global object make sure that you set it as global yourself.

Using the customer API object

After you have an instance of customer API object you can call one of the following functions from this object.

`setExternalId(externalId: string): void`

This is a function used to set a unique identifier for the current user to identify it for analytics purposes. The external unique identifier is used to identify the same user when the hosting customer can identify the same user in several different platforms but Gamitee has no permissions for that.

best practices

  • Use that option when you have a network of websites that has the same users but different domains or you use a different systems, one for collecting the website offerings and the other to checkout.
  • The best external identifier can be your own identification strings or one provided by external systems like Google Analytics. It's not recommended to use meaningful identifiers like emails or phone numbers for security reasons.