xcode Firebase Analytics -如何查看特定内容而不是控制器?

np8igboo  于 2022-12-05  发布在  其他
关注(0)|答案(1)|浏览(145)

我有一个充满故事的应用程序,我想看看用户正在阅读哪些故事。
我已经安装了Firebase Analytics,但我看到的只是这样的内容:

我希望能够看到用户正在阅读的故事的具体标题。
这是我正在使用的ForEach循环:

ForEach(modelData.stories.shuffled()) { item in
                    if item.paid == false {
                        NavigationLink {
                            StoryDetails(story: item)
                        } label: {
                            GeneralCard(isLocked: false, story: item)
                        }

                    }
                }

在StoryDetails上,我有这样的代码,我想在Firebase Analytics中看到故事的标题。

VStack (spacing: 0) {
                Text(story.title)
                    .font(AppFont.detailTitle())
                    .bold()
                    .multilineTextAlignment(.center)
                    .foregroundColor(.mainColor)
                
                Text(story.category.rawValue)
                    .font(AppFont.detailDescription())
                    .multilineTextAlignment(.center)
                    .padding()
                    .foregroundColor(.mainColor)
                
                VStack(alignment: .leading, spacing: 20) {
                    
                    ForEach(story.text, id: \.self) { item in
                        VStack {
                            Text(item)
                                .font(AppFont.detailText())
                        }
                    }
                }
                //.padding(.horizontal, 10)
            }

这是可以做到的吗?
先谢了

gxwragnw

gxwragnw1#

你可以通过手动记录你的屏幕视图来设置它。对于SwiftUI,它是这样的:

struct ContentView: View {
  var body: some View {
    Text("Hello, world!")
       // Logging screen name with class and a custom parameter.
      .analyticsScreen(name: "main_content",
                       class: "ContentView",
                       extraParameters: ["my_custom_param": 5])

      // OR Logging screen name only, class and extra parameters are optional.
      .analyticsScreen(name: "main_content")
  }
}

相关问题