【问题标题】:Interpretation of Google Analytics Multi Channel Funnel Interactions解读谷歌分析多渠道漏斗交互
【发布时间】:2017-04-24 19:05:13
【问题描述】:

Google Analytics 提供MCF data。我想在使用 R 转换之前使用这些数据来解释媒体之间的交互。

为简化起见,假设我有 2 行包含中间路径以及与每个路径关联的总转化次数:

  • 直接 > 每次点击费用 > 有机 > 每次点击费用 > 推荐 > 直接 | 3 次转化

  • 有机 > 直接 > 每次点击费用 > 推荐 > 每次点击费用 > 直接 | 1 次转化

使用 R,您将如何管理数据框以获取此信息:

  • 每个通道在另一个通道之前的次数。因此,例如直接在每次点击费用之前(在我的中间路径中“直接>每次点击费用”的出现次数由转化次数加权)

问题是当我继续时,最终数据帧的列数很大(每个通道组合 1 个)。

  1. 您将如何处理 R 中的数据以获得“清晰”且可解释的数据框?
  2. 您会使用相同的方法还是使用简单的方法?
  3. 你会使用哪些 R 包(从现在开始我只是简单地使用 stringr 来操作路径字符串)?
  4. 另外,您知道可以执行更多图形分析的映射包吗?

谢谢。

西尔万

【问题讨论】:

  • 请具体说明您的问题。这里似乎提出了多个问题,其中一个要求工具推荐。
  • 欢迎来到 SO。你可以改进你的问题。请阅读how to provide minimal reproducible examples in R。一篇好的帖子有一个特定的编程问题,而不仅仅是要求一般性建议。它通常提供最少的输入数据、所需的输出数据和代码尝试——所有这些都可以在新的/干净的 R 会话中复制粘贴运行。

标签: r google-analytics


【解决方案1】:

这是一个例子:

df <- read.table(sep="|", stringsAsFactors = F, text="
direct > cpc > organic | 3 conversions
organic > direct > cpc > email | 1 conversion
cpc > email | 10 conversion")
df[,1] <- trimws(df[,1])
df[,2] <- as.integer(gsub("\\D","",df[,2]))
lst <- strsplit(df[,1], " > ", T)
lst <- lapply(lst, function(x) matrix(embed(x, 2)[, 2:1], ncol=2))
res <- as.data.frame(do.call(rbind, lst))
res$V3 <- rep(df[,2], sapply(lst, nrow))
(res <- aggregate(V3~V1+V2, res, sum))
#        V1      V2 V3
# 1  direct     cpc  4
# 2 organic  direct  1
# 3     cpc   email 11
# 4     cpc organic  3

library(igraph)
g <- graph_from_data_frame(setNames(res, c("source", "target", "weight")))
plot(
  g, 
  edge.width = plotrix::rescale(E(g)$weight, c(1,5)), 
  edge.label = E(g)$weight
)

您可能还想查看包channelAttribution 进行归因建模。

【讨论】:

  • 非常感谢。这是完美的。
  • 欢迎。如果答案解决了您的问题,请随意勾选复选标记以关闭问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-03-04
相关资源
最近更新 更多