Defold Engine integration with Yandex.Metrica to track your games on Yandex.Games.

Overview

Yandex.Metrica for Defold

Yandex.Metrica is a free of charge web analytics tool for websites, that's the reason why we can use it for HTML5 games. Yandex.Metrica is one of the top three leading web analytics solutions in the world.

Don't be confused with AppMetrica by Yandex - it's an iOS/Android app analytics.

This native extension doesn't implement all Yandex.Metrica functions, but they are enough to track most of the stats of your game.

Supported Platforms

Platform Status
Browser (HTML5) Supported

Installation & Usage

1. Create Yandex.Metrica Tag

You need a Yandex ID in order to work with Yandex.Metrica. If you don't have one, you first need to sign up.

On the page with the list of tags, add a tag. The tag setup page opens. Then fill in the information:

  • Tag name. The specified name is shown on the My tags page and in the upper menu for switching between tags. Use the name of your Defold game.
  • Site URL. Put the address of your game on Yandex.Games like yandex.ru/games/play/123456.

Then accept the Terms of use, click Create a tag. Copy the ID of your counter.

2. Add YaMetrica As Dependency

You can use YaMetrica in your own project by adding this project as a Defold library dependency.

Open your game.project file and in the dependencies field under project add the ZIP file of a specific release.

Then add the following to your game.project file:

[yametrica]
counter_id = PUT_YOUR_COUNTER_ID_HERE

Setting the yametrica.counter_id option initializes Yandex.Metrica SDK in the HTML5 template (take a look at how it's done). From this moment, you can call yametrica.* functions.

3. Call YaMetrica Methods

In your main.script call not_bounce to send information about a non-bounce. It means, for the Yandex.Metrica, that your game finished loading:

function init(self)
	if yametrica then
		yametrica.not_bounce()
	end
end

Then, for every in-game events like scene switching or level ending, call hit:

if yametrica then
    yametrica.hit("#event-name", { title: "Event Name" })
end

Best Practices

Keep in mind that Yandex.Metrica is web analytics for websites, but you are going to use it for an HTML5 game, which is, technically, a single-page website.

  1. Call hit(..) to track significant events in your game: start/end of a level, show/hide of a scene, calling fullscreen ads, etc.
  2. Use anchor identifiers as IDs of events and titles as the name of events: yametrica.hit("#scene-started-introduction", { title: "Scene Started: Introduction" }).
  3. It's crucial to call hit(..) quite often to have a precise Session Length value.

Lua <-> JS

Yandex.Metrica JS SDK YaMetrica Lua API
ym(XXXXXX, 'hit', url[, options]) yametrica.hit(url, [options])
ym(XXXXXX, 'notBounce', [options]) yametrica.not_bounce([options])
ym(XXXXXX, 'params', visitParams[, goalParams]) yametrica.params(visit_params, [goal_params])
ym(XXXXXX, 'reachGoal', target[, params[, callback[, ctx]]]) yametrica.reach_goal(target, [params])
ym(XXXXXX, 'userParams', parameters) yametrica.user_params(parameters)


ym(XXXXXX, 'addFileExtension', extensions) Not implemented
ym(XXXXXX, 'extLink', url[, options]) Not implemented
ym(XXXXXX, 'file', url[, options]) Not implemented
ym(XXXXXX, 'getClientID', function(clientID) { <function body> }) Not implemented
ym(XXXXXX, 'setUserID', "12345") Not implemented

Credits

Artsiom Trubchyk (@aglitchman) is the current YaMetrica owner within Indiesoft and is responsible for the open source repository.

This project uses the source code of CJSON.

License

MIT license.

Releases(1.0.0)
Owner
Indiesoft LLC
Indiesoft LLC
ZzFX extension for Defold

ZzFX Defold Extension Zuper Zmall Zound Zynth ZzFX Sound Designer Port of ZzFX for the Defold Game Engine WIP Pending release while I work through som

Justin Walsh 6 Nov 25, 2021
Defold Math eXtention Library that avoids allocations

A re-imagining of vmath functions that avoid allocations by taking the output as the first argument instead of returning a new Vector3, Vector4, or Quat requiring an allocation.

Justin Walsh 7 Feb 23, 2022
ZzFX extension for Defold

ZzFX Defold Extension Zuper Zmall Zound Zynth ZzFX Sound Designer Port of ZzFX for the Defold Game Engine Defold Setup Open your game.project file and

Justin Walsh 6 Nov 25, 2021
A blender import/export system for Defold

defold-blender-export A blender import/export system for Defold Setup Notes There are no exhaustive documents for this tool yet. Its just not complete

David Lannan 21 Jun 3, 2022
keyball is split keyboard has 100% track ball

keyball Keyball is split keyboard has 100% track ball Firmware build guide Keyball46 have separate firmwares for each of PCBs w/ trackball and w/o tra

null 94 Jun 23, 2022
Please feel free to use this code if you need to keep track of accelerometer and gyro data :)

IMUArduinoDataCollection Please feel free to use this code if you need to keep track of accelerometer and gyro data :) This code takes in xyz motion b

null 1 Nov 9, 2021
A GPS bicycle speedometer that supports offline maps and track recording

X-TRACK 开源GPS自行车码表。 拥有可显示实时位置的离线地图。 支持记录和显示实时轨迹以及导出标准GPX格式的轨迹文件。 全新设计的"页面生命周期管理"和"消息订阅发布框架"。 演示视频:https://www.bilibili.com/video/BV1GB4y1K7VV GUI LVGL

_VIFEXTech 3.5k Jun 28, 2022
Raspberry Pi Pico (RP2040) and Micro-ROS (ROS 2) Integration

The Pico is an amazing microcontroller and I couldn't wait for ROS 2 support or Arduino Core, so here is my approach. Once the Arduino Core for RP2040 is out it will be easier to use micro_ros_arduino.

Darko Lukić 19 Jun 19, 2022
Solving Kepler's equation via contour integration, implemented in C++

Kepler's Goat Herd Code for solving Kepler's equation using contour integration, following Philcox et al. (2021, arXiv). This uses a method originally

Oliver Philcox 45 Nov 8, 2021
ESPHome integration for the Xiaomi Mijia Bedside Lamp v2.

esphome-xiaomi_bslamp2 Warning: this code is still under development This code might not yet be production-ready. At this point, it is declared beta-q

Maurice Makaay 111 Jun 21, 2022
font rendering, Zep vim emulator, microui integration

LabFont This project is an exploration of getting text into a rendeing pipeline based on @floooh's sokol. Frameworks such as Dear ImGui solve text ren

Nick Porcino 13 Jan 23, 2022
JWM is a cross-platform Java window management and OS integration library.

JWM aims to expose an interface that abstracts over window creation, input handling and OS integration

JetBrains 338 Jun 22, 2022
A gdnative plugin for Godot's UWP export to add xbox live integration

GodotXbox Current instructions for setting up DLL, steps to setup project for contributing/modifying are coming soon. It should be noted that Godot's

Cregg Hancock 29 Jul 2, 2022
Yet Another Ghidra Integration for IDA

Yagi Yet Another Ghidra Integration for IDA Overview Yagi intends to include the wonderful Ghidra decompiler into both IDA pro and IDA Free. ?? You ca

Airbus CERT 361 Jun 20, 2022
X-CUBE-AZRTOS-F4 (Azure RTOS Software Expansion for STM32Cube) provides a full integration of Microsoft Azure RTOS in the STM32Cube environment for the STM32F4 series of microcontrollers.

X-CUBE-AZRTOS-F4 Azure RTOS Software Expansion for STM32Cube With Azure RTOS complementing the extensive STM32Cube ecosystem providing free developmen

STMicroelectronics 21 Jun 3, 2022
Integration of Rust code with a C Kernel Module

Rust-Kernel-Mod Description Integration of Rust code with a C Kernel Module This project sets up a minimalistic Linux kernel module in C which it uses

Dylan Turner 1 Nov 1, 2021
Swift Framework for Apple Health Integration with Terra Enabling Developers LTD.

TerraSwift This library allows developers to connect to TERRA ENABLING DEVELOPERS LTD. through Swift (implemented with Swift5.0). This library uses He

null 7 Mar 18, 2022
Caffeecoin Core integration/staging tree

Caffeecoin Core integration/staging tree https://caffeecoin.com What is Caffeecoin? Caffeecoin is an experimental digital currency that enables instan

null 4 Feb 28, 2022
2D/3D Registration and system integration for image-based navigation of orthopedic robotic applications, inculding femoroplasty, osteonecrosis, etc.

Registration and System Integration Software for Orthopedic Surgical Robotic System This repository contains software programs for image-based registr

Cong Gao 14 Jun 11, 2022