XaiJu
Renpytom
Renpytom

patreon


Adding Google Analytics to Your Visual Novel

Traditionally, a visual novel is released, and that's it. Unless a player gives a review, there's little feedback as to what happens after that. The creator might be interested in knowing how many players play the game, how many make it through the game, and how many make it to an ending, but it's been difficult to get feedback on these topics.

This month's article will show you how to add Google Analytics to your Ren'Py visual novel. Of course, some users won't want to be tracked, so the framework is controlled by a preference that the user is prompted for. With this information, a game creator can understand how players play the game. This might be useful to discover unreachable paths, create fan material, and of course, answer the eternal question: Who is best girl?

Adding Google Analytics to Your Visual Novel

Comments

From version 8.0.3 with python 3 it is necessary to change a line from `queue.append(urllib.urlencode(kwargs))` to `queue.append(urllib.parse.urlencode(kwargs))` on analytics.rpy As of July 2023 the Universal Analytics standard. will be discontinued by google. This way the sending of events will undergo some changes, so the analytics file will need some changes. I made some changes to the file for my scenario. But I believe that in a scenario where other developers will use it, it's better to think of a reusable pattern. The planned changes are in this link https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events?client_type=gtag Everything works fine for me by changing the points described in the google documentation.

oldhiccup

Working in Android ?

Adn700 - NSFW

Thanks Suhalmi! That's great info. How did you find out that the mobile version requires Firebase? PLEASE do share if you happen to make mobile tracking work using Firebase!

Cookie NomNom

I can only get the data tracked on pc applications but not the published android app if I follow your steps. The Google Analytics mobile app version requires the use of Firebass which I'm not sure about either.

Suhaimi Zainal Shah

Hi Bruni. Thanks for your response. Yes, I select the option that the app needs to have access to the internet when I build the app on RenPy. Players can make in-app purchases as well, so I think I'm pretty sure that the app can access the internet.

Cookie NomNom

Is your app able to access the internet? The issue could be there.

Bruni Multimedia

One question for you PyTom - should this work only on web or is it supposed to work on mobile as well? I can see all the events on web, but am getting nothing when I try this on mobile...

Cookie NomNom

I've implemented this and it works like a charm! Very easy to implement as well. Thanks PyTom!!!

Cookie NomNom

This is a huge feat! Thank you!!!

Bruni Multimedia

That's something I was waiting for, thank you!

MANITU Games

That's pretty wild ^^ Looks like it's not too difficult to implement either. Thank you for taking the time to write that up!

geckosart

Exactly. I found it funny that it sounds like a meme, but to a dev, it's serious business. Or at least semi-serious.

Renpytom

No, you can't. If a user opts out, the framework won't send any data.

Renpytom

Very nice. I really like these guides. Its a great way to learn more about Renpy. I'm tracking events using Firebase instead, and after some months collecting data I can say that its really great to understand the flow of the game. I could see where ppl were leaving and discover what ppl were loking while playing the game. "Who is best girl?" sounds like just a meme, but its really vital to game developers. You need to understand what your players are looking for, so you can give them that.

Glenn

That's awesome! Can we tell how many people opted out too?

noeinan


More Creators