Best practice for tagging player on initial run?

Right after doing the initial setup in my main.lua I used the following snippet to tag devices by platform. Just testing the tags.

if isIOS == true then

    GameThrive.TagPlayer(“Platform”, “IOS”)

else

    GameThrive.TagPlayer(“Platform”, “Android”)

end

And I got a nasty stack trace telling me that the plugin can’t get the Player_ID yet… Of course the backend needs some time to register the new device… So I run the same code again and no error… Now tagging happens nicely. 

So as a best practice, it seems as though we need to either delay the tagging a little bit after the initial run of the app or perhaps play it safer by using GameThrive.IdsAvailableCallback(IdsAvailable) before attempting to tag. Would you agree? 

How would you do this? Thanks for your suggestions.

Hi Ksan. Yes, for now you should wait until GameThrive.IdsAvailableCallback is triggered.

We’ll be updating the library later this week so that this happens automatically (We will queue up tags and submit them behind the scenes once the device is registered with our system).

Super. Very impressive service. Transitioned in less than 10 minutes. Thanks for making this happen.

Hi, just checking in to see if the queueing update has gone live. I’m still seeing this problem so I was wondering if I should wait or code in the check before you tag approach discussed above. Thanks for your guidance.

Edit : Works like a charm! Thanks much. 

Hey Ksan. Haven’t gotten to this yet unfortunately – we’re in the process of getting some of our other SDKs into good shape (Almost done!) and then we’ll circle back to this. We’ll likely get to it by the end of the week.

If you need something sooner then the IdsAvailableCallback solution should definitely work.

Here’s an (untested) example of how you might do it now:

local tags = {}

local isConnected = false

local function deliverTags()

 GameThrive.TagPlayerWIthTable(tags)

end

local function setTag(key,value)

 tags[key] = value

 if(isConnected)

   deliverTags()

 end

end

local function gamethriveCallback()

  isConnected = true

  deliverTags()

end

GameThrivePushNotifications.IdsAvailableCallback(gamethriveCallback)

No worries. Thanks much for that code snippet. It should work just fine. Will try now. Thanks again.

Hi Ksan. Yes, for now you should wait until GameThrive.IdsAvailableCallback is triggered.

We’ll be updating the library later this week so that this happens automatically (We will queue up tags and submit them behind the scenes once the device is registered with our system).

Super. Very impressive service. Transitioned in less than 10 minutes. Thanks for making this happen.

Hi, just checking in to see if the queueing update has gone live. I’m still seeing this problem so I was wondering if I should wait or code in the check before you tag approach discussed above. Thanks for your guidance.

Edit : Works like a charm! Thanks much. 

Hey Ksan. Haven’t gotten to this yet unfortunately – we’re in the process of getting some of our other SDKs into good shape (Almost done!) and then we’ll circle back to this. We’ll likely get to it by the end of the week.

If you need something sooner then the IdsAvailableCallback solution should definitely work.

Here’s an (untested) example of how you might do it now:

local tags = {}

local isConnected = false

local function deliverTags()

 GameThrive.TagPlayerWIthTable(tags)

end

local function setTag(key,value)

 tags[key] = value

 if(isConnected)

   deliverTags()

 end

end

local function gamethriveCallback()

  isConnected = true

  deliverTags()

end

GameThrivePushNotifications.IdsAvailableCallback(gamethriveCallback)

No worries. Thanks much for that code snippet. It should work just fine. Will try now. Thanks again.