如何通过测量协议V2通过事件发送自定义维度,中等,源或参考器?

发布于 2025-02-02 00:08:13 字数 1121 浏览 4 评论 0 原文

使用测量协议的V1,您可以使用这些参数添加自定义尺寸或更改介质,源或参考页面视图:

of pageview]& dh = [pageview of PageView] cs = [new-source]& dr = [new-enderferer]& cd1 = [custom-dimension-1]& cd2 = [custom-dimension-2]

在测量协议v2中如何完成?

我找不到有关V2中页面视图事件的任何文档(例如,此处没有提及 ),即使是事件 - 布尔德( https://ga-dev-tools.web.app.app/ga4/event-builder/ )不支持简单的page-view。

因此,我到目前为止所得到的只是:

$data = '
{    "client_id": "'.[custom-id].'",
     "events": [
     {
         "name": "page_view",
         "params": {
                "page_location": "'.[Url of pageview].'"
         }
     }
     ]
 }
 ';

那么,页面视图事件的可能参数是什么?

With v1 of the measurement protocol, you could use these parameters to add custom dimensions or change medium, source or refer for a page view:

https://ssl.google-analytics.com/collect?v=1&tid=UA-xxxxxxxx&cid=[custom-id]&t=pageview&dp=[Url of pageview]&dh=[hostname of pageview]&cm=[new-medium]&cs=[new-source]&dr=[new-referer]&cd1=[custom-dimension-1]&cd2=[custom-dimension-2]

How is it done in measurement protocol v2?

I couldn't find any documentation about the page-view-event in V2 (for example it's just not mentioned here
https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference/events), even the event-builder (https://ga-dev-tools.web.app/ga4/event-builder/) doesn't support a simple page-view.

So, all I got so far is this:

$data = '
{    "client_id": "'.[custom-id].'",
     "events": [
     {
         "name": "page_view",
         "params": {
                "page_location": "'.[Url of pageview].'"
         }
     }
     ]
 }
 ';

So, what are possible parameters for a page-view-event?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苹果你个爱泡泡 2025-02-09 00:08:13

那么这里应该知道一些事情

  1. 好的,如果您正在使用MP:测量协议是一个糟糕的名字, 。这意味着有多个用于数据收集的协议。没有。只有一个可以跟踪的协议。
  2. MP2仍然很大程度上MP1。 Google试图将GA4作为新产品构成,但这只是我们旧的Good Ga UA,并具有简化的后端和过度工程的前端,它试图提供高质量的网站催化剂/Omniture/Adobe Analytics的水平已有十年。 MP在很大程度上是相同的。 DR,CM,CS和许多其他领域仍在那里。 CD不再存在了,因为它们被EPS和UPS所取代,但稍后更多。
  3. GA4使用了这一大型营销声称,与旧分析相比,新的分析基于事件非常奇妙。当我挖掘他们为什么在任何地方都声称这一点时,我意识到唯一的区别是pageviews现在是事件。确实没有太大的区别。但是,是的,pageView只是一个名为page_view的事件。我们稍后再讨论。
  4. 自定义尺寸已不复存在。现在它们称为事件属性和用户属性。同样的事情确实,Google只是试图使不再有会话级别自定义维度的显而易见。或产品级CD。尽管产品级别似乎在其路线图上。
  5. 确保您使用正确的测量ID。他们使在ga4 中找到它。不幸的是,它不再只是属性列表中可见的属性ID。
  6. GA的实时报告并未包含所有维度,尤其是如果这些维度与高级指标/维度计算有关。请勿使用实时报告检查活动的内容。这并不是要调试。这是虚荣报告。当您发送一堆事件并期望在GA中看到它们时,仍然很有帮助。 Google甚至有警告在这里::

与DebugView报告一样,实时报告执行有限的归因分析以确保响应式报告。我们建议您参考以获取最准确的归因信息的收购报告。

最后,我经常做的而不是阅读MP2上的So-Still-not-not-not-notly-notly-thelly-hellpully文档,要么使用

或者,由于是这种情况,我只会在测试GTM中实现一个绰号跟踪,然后查看其发送到网络调试器中的位置以及如何将其发送到网络调试器的位置,然后将其重新完成在我这方面,完全将其重新完成。不涉及魔法。这是我的GTM标签的样子:

”“在此处输入图像描述”

在任何单击或任何页面加载上都有触发器。毕竟,我发布了自由。然后,我将此GTM的代码注入本地网站或测试站点,或者您想对其进行测试。并触发您需要与MP模拟的标签。

我使用

现在,这就是上述标签通过扩展名在我的测试站点上的外观:

“在此处输入图像描述”

非常有用。

我怎么知道page_referrer用作GTM中的DR代替EP? 在这里是永远不会看到的列表作为EP。但是Google不太在意将它们正确地映射到MP中所谓的这些字段,因此您必须测试或知道,或者在其他地方进行Google。

最后,这是网络请求的样子:

”在此处输入图像描述”

我发布了标签(我保留一个测试站点),因此您可以去看一下。或者只是找到一个使用GA4并查看其网络请求的站点。 Google怎么知道这是一个浏览量?通过事件名称: en = page_view

当然,您可以使用媒介和源进行。从我已链接到上面的文档来看,媒体和源看起来像竞选竞选>竞选> apeip_medium 。 GTM将它们相应地映射到 cs cm 字段。这就是您知道这些是正确的MP字段的方式。给GA处理这些时间并在几天内检查它们。

很好,现在这也适用于增强的电子商务的热门单曲,只是它们通常具有更多的变量和数据结构。

最后,如果您想模拟批处理事件,只需快速连续地制作一些标签,而GTM会在一个网络请求中整齐地包装它们。然后,您可以通过与我们在这里进行模拟相同的方法来消化如何完成包装。

Ok, a few things here right away that you should know if you're playing with MP:

  1. Measurement protocol is a poor name. It implies there's more than one protocol for data gathering. There's none. There is just only one protocol for tracking.
  2. MP2 still largely MP1. Google tries to pose GA4 as a new product, but it's just our old good GA UA with a simplified backend and overengineered front-end that tries to deliver the level of quality Site Catalyst/Omniture/Adobe Analytics have been delivering for a decade. MP is largely the same. dr, cm, cs and a lot of other fields are still there. cds aren't there anymore cuz they're replaced with eps and ups, but more about that a bit later.
  3. GA4 uses this big marketing claim that the new analytics is so wonderfully event-based, unlike the old one. When I dug into why they keep claiming it everywhere, I realized that the only difference is that pageviews are now events. Not much difference really. But yes, a pageview is just an event named page_view. We'll talk about it a bit more later.
  4. Custom dimensions are no more. Now they're called event properties and user properties. The same thing really, Google just tries to make it less obvious that there are no more session level custom dimensions. Or product-level CDs. Though the product level is seemingly on their roadmap.
  5. Make sure you're using the correct measurement id. They made it a lot harder to find it in GA4. It's no longer just the property id visible in the property list, unfortunately.
  6. GA's real-time reports don't include all dimensions, especially if those dimensions are involved in advanced metrics/dimensions calculations. Do not use real time reports for inspecting the content of your events. It's not meant for debugging. It's a vanity report. Still helpful to check the volume of events when you're sending a bunch and expect to see them in GA. Google even has a warning here:

Like the DebugView report, the Realtime report performs limited attribution analysis to ensure responsive reporting. We recommend that you refer to the Acquisition reports for the most accurate attribution information.

Finally, what I often do instead of reading the so-still-unfinished-and-not-really-helpful documentation on MP2, is either use a library like this.

Or, since 1 is the case, I would just implement a moniker tracking in my test GTM, then see what and how it sends to where in the Network debugger and simply reimplement it on my side exactly how GTM does it. No magic involved. Here is how my GTM tag would look like:

enter image description here

With a trigger on any click or any page load. After all is done, I publish the lib. Then I would inject this GTM's code in a local site, or in my test site, or however else you want to test it. And trigger the tag that you need to mimic with MP.

I use this wonderful extension to show all events that fire and their details right in my console.

Now this is how the above tag looks on my test site through the extension:

enter image description here

It's pretty useful.

How do I know that page_referrer is used as dr instead of ep in GTM? Here is the list of the fields that will never be seen as ep. But Google doesn't care enough to map them properly to what these fields are called in MP, so you either have to test, or know, or google it elsewhere.

Finally, here is how the network request looks like:

enter image description here

I published the tag to prod (I keep a test site in prod), so you can go and look at it. Or just find a site that uses GA4 and see its network requests. How does google know that this is a pageview? by the event name: en=page_view

Of course, you do the same with medium and source. Judging from the documentation I've linked to above, the medium and source look like campaign_source and campaign_medium in GTM. GTM maps them accordingly to cs and cm fields. And that's how you know these are the correct mp fields. Give GA time to process these and check on them in a few days.

Good, now this is applicable to the enhanced ecommerce hits too, it's just that they have more variables and data structures in them typically.

Finally, if you want to simulate batch events, you can just make a few tags fire in rapid succession and GTM will neatly pack them in one network request if they fit. You can then digest how the packing is done through the same methods as we do here and simulate.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文