使用测量协议的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?
发布评论
评论(1)
那么这里应该知道一些事情
最后,我经常做的而不是阅读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:
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:
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:
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:
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
andcampaign_medium
in GTM. GTM maps them accordingly tocs
andcm
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.