Hi, I'm trying to create a public leaderboard using the Javascript SDK, I just need to be able to display the leadboard on a html page for now Im authenticating with a test user but I was wondering if there is any better way to do this.
Thanks
Best Answer
C
Customer Support
said
over 4 years ago
Hi Hjupter,
That's a valid approach. Another way to do it would be to make a custom callback script and within it send a SparkRequest as a test player to send a LeaderboardDataRequest. The response object can just be set to scriptData for display on your page. While you would still require a player account to send the request this method will save you having to authenticate a player to achieve the reasults.
That's a valid approach. Another way to do it would be to make a custom callback script and within it send a SparkRequest as a test player to send a LeaderboardDataRequest. The response object can just be set to scriptData for display on your page. While you would still require a player account to send the request this method will save you having to authenticate a player to achieve the reasults.
Regards,
Liam
H
Hjupter Cerrud
said
over 4 years ago
This is just what I needed!.. it works like a charm!.. the whole process its faster and safer.
H
Hjupter Cerrud
said
over 4 years ago
Oh forgot to say, Thank you so much Liam for the quick answer.
Customer Support
said
over 4 years ago
Hi Hjupter,
No problem !
Liam
H
Hjupter Cerrud
said
over 4 years ago
Hi quick question, is it possible to redirect to another page using custom callbacks? .. Im trying to create an affiliate system where players click on a link with an affiliate id then set a cookie with it and redirect to the appstore download then read that cookie and assign a segement based on the affliate id. Any thoughts?
Customer Support
said
over 4 years ago
Hi Hjupter,
You could pass the source in via the callback url and then check it in the callback script and set the appropriate url to redirect to in scriptData in the response.
https://{apikey}.{stage}.gamesparks.net/callback/{apikey}/{credential}/{credentialSecrect}/?source=MySource
//In the callback script
Spark.setScriptData("source", Spark.getData().source)
Hjupter Cerrud
Hi, I'm trying to create a public leaderboard using the Javascript SDK, I just need to be able to display the leadboard on a html page for now Im authenticating with a test user but I was wondering if there is any better way to do this.
Thanks
Hi Hjupter,
That's a valid approach. Another way to do it would be to make a custom callback script and within it send a SparkRequest as a test player to send a LeaderboardDataRequest. The response object can just be set to scriptData for display on your page. While you would still require a player account to send the request this method will save you having to authenticate a player to achieve the reasults.
Regards,
Liam
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi Hjupter,
That's a valid approach. Another way to do it would be to make a custom callback script and within it send a SparkRequest as a test player to send a LeaderboardDataRequest. The response object can just be set to scriptData for display on your page. While you would still require a player account to send the request this method will save you having to authenticate a player to achieve the reasults.
Regards,
Liam
Hjupter Cerrud
This is just what I needed!.. it works like a charm!.. the whole process its faster and safer.
Hjupter Cerrud
Oh forgot to say, Thank you so much Liam for the quick answer.
Customer Support
Hi Hjupter,
No problem !
Liam
Hjupter Cerrud
Hi quick question, is it possible to redirect to another page using custom callbacks? .. Im trying to create an affiliate system where players click on a link with an affiliate id then set a cookie with it and redirect to the appstore download then read that cookie and assign a segement based on the affliate id. Any thoughts?
Customer Support
Hi Hjupter,
You could pass the source in via the callback url and then check it in the callback script and set the appropriate url to redirect to in scriptData in the response.
Will that work for you here ?
Regards,
Liam
Hjupter Cerrud
I figured I can redirect by doing this
The problem is the cookie, I was able to set the cookie with this:
But when I try to read the cookie from the callback it doesnt work, I suppose its related to this: https://support.gamesparks.net/support/discussions/topics/1000087288
So I guess I wont be able to do this for now.
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics