Created
August 16, 2018 14:08
-
-
Save catacs/84006eb972877d5494003583e579c947 to your computer and use it in GitHub Desktop.
Example Firebase Analytics setCurrentScreen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local firebaseAnalytics = require "plugin.firebaseAnalytics" | |
firebaseAnalytics.init() | |
local widget = require("widget") | |
local bg = display.newRect( display.contentCenterX, display.contentCenterY, display.actualContentWidth, display.actualContentHeight ) | |
bg:setFillColor( 1,.5,0 ) | |
local title = display.newText( {text = "Firebase Analytics", fontSize = 30} ) | |
title.width, title.height = 300, 168 | |
title.x, title.y = display.contentCenterX, 168*.5 | |
title:setFillColor(1,0,0) | |
local eventLog1 | |
local index = 0 | |
firebaseAnalytics.setCurrentScreen('startMainScreen', 'main.lua') | |
eventLog1 = widget.newButton( { | |
x = display.contentCenterX, | |
y = display.contentCenterY, | |
id = "log1", | |
labelColor = { default={ 1, 1, 1 }, over={ 0, 0, 0, 0.5 } }, | |
label = "logEvent Hello , World", | |
onEvent = function ( e ) | |
if (e.phase == "ended") then | |
firebaseAnalytics.logEvent("select_content", {content_type = "hello", item_id= "world"}) | |
firebaseAnalytics.setCurrentScreen('mainScreen'..index, 'main.lua') | |
index = index + 1 | |
print( "event logged" ) | |
end | |
end | |
} ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment