0

I manage analytics for a hotel/resort site that contains 8 distinct properties, all on a single domain where each property has its own subdomain. There's a splash page at www.example.com which links to all the other properties, and the properties are located on property1.example.com, for example. I should also mention that we're using Universal Analytics nestled cozily within a Google Tag Manager container.

The problem is that for certain transactions the custom metrics are all being multiplied. 95% of purchases are for a single-room, but what's being reported in GA does not match our back-end data. Please note how the Adults metrics are all even numbers:

Metrics double counting or more

To further complicate the issue, I am using a custom HTML script which dynamically sets the corresponding property ID using a Macro:

<script>
if({{hostname}} == "property1.example.com"){
dataLayer.push({'ua': '2', 'event': 'INIT'});
}
else if({{hostname}} == "property1-ssl.example.com"){
dataLayer.push({'ua': '2', 'event': 'INIT'});
}
else if({{hostname}} == "property2.example.com"){
dataLayer.push({'ua': '3', 'event': 'INIT'});
}
else if({{hostname}} == "property2-ssl.example.com"){
dataLayer.push({'ua': '3', 'event': 'INIT'});
}
...(etc.)
</script>

The rollup account is UA-XXXXXX-1, property1 is UA-XXXXXX-2, property2 is UA-XXXXXX-3, and so forth. The rollup property is contained within a separate tag than the individual properties because it needs to fire in tandem with the property-level tag; it fires on all pages.

We're using the dataLayer to define 5 custom metrics and 6 custom dimensions. These variable pairs are first set using natural language (i.e. Check-In Date), then converted to their corresponding metric or dimension (i.e. dimension1) using a custom HTML tag.

Here is an example of some source code:

<script>
dataLayer = [{
'transactionId': '1330068',
'transactionAffiliation': 'Property1',
'transactionTotal': '3213',
'transactionTax': '931.77',
'transactionShipping': '0',
'transactionProducts': [{
'sku': '1815',
'name': 'Terrace Junior Suite',
'category': 'Example Resort Property1 - Beach Front',
'price': '3213',
'quantity': '1'
}
,{
'sku': '2256',
'name': 'Welcome Tequila Amenity',
'category': 'Example Resort Property1',
'price': '0',
'quantity': '1'
}
,{
'sku': '2257',
'name': 'Daily Fresh Fruit',
'category': 'Example Resort Property1',
'price': '0',
'quantity': '1'
}
,{
'sku': '2611',
'name': 'Complimentary In-Room Espresso and Tea Service',
'category': 'Example Resort Property1',
'price': '0',
'quantity': '1'
}],
'Room Nights': '3',
'Rooms': '1',
'Adults': '2',
'Children': '0',
'Check-In': '10/29/2013',
'Check-Out': '11/01/2013',
'Country of Origin': 'US',
'State of Origin': 'IL',
'Promo Code': '',
'Night Booking': 'yes',
'Timestamp': '60733'
}];
</script>

Here is the script I have which maps the natural language definitions to the GA-friendly index:

<script>
ga('set', {
  'dimension1': '{{Check-In}}',
  'dimension2': '{{Check-Out}}',
  'dimension3': '{{Country of Origin}}',
  'dimension4': '{{State of Origin}}',
  'dimension5': '{{Promo Code}}',
  'dimension6': '{{Night Booking}}',
  'metric1': '{{Room Nights}}',
  'metric2': '{{Rooms}}',
  'metric3': '{{Adults}}',
  'metric4': '{{Children}}',
  'metric5': '{{Timestamp}}'
});
</script>

And finally, I have a Universal Analytics pageview tag to fire off these custom metrics & dimensions. The rules for this tag are: is the confirmation URL, and event = INIT. pushing the metrics & dimensions

I could provide more details if needed, but I fear I may have lost most of you already. I think the problem relates to my custom tags, or with how the custom metrics & dimsensions are being pushed to the GA server. Thanks so much for the help!

4

3 回答 3

1

调用 ga('set', {your dimensions here}) 应该告诉通用分析在该跟踪器对象的生命周期内(即直到加载新页面)的每次命中发送数据。因此,如果您在同一页面上发送了综合浏览量和交易,瞧——指标翻倍。

检查这是否是问题的一种快速方法是创建自定义交易报告,并查看您的任何自定义维度/指标是否与该命中相关联。

于 2013-10-31T03:53:34.053 回答
0

场景大分解。花了几分钟,但我想我可以解决这个问题。

我认为问题是 ga set (this),并且与您的想法一致:

<script>
ga('set', {
  'dimension1': '{{Check-In}}',
  'dimension2': '{{Check-Out}}',
  'dimension3': '{{Country of Origin}}',
  'dimension4': '{{State of Origin}}',
  'dimension5': '{{Promo Code}}',
  'dimension6': '{{Night Booking}}',
  'metric1': '{{Room Nights}}',
  'metric2': '{{Rooms}}',
  'metric3': '{{Adults}}',
  'metric4': '{{Children}}',
  'metric5': '{{Timestamp}}'
});
</script>

您在此处设置所有维度/指标,但您也在 Universal Analytics(测试版)标签(此处)中设置它们:

Universal Analytics 代码设置

只有一个是必需的,因为当您在 Universal Analytics 代码中引用宏,即 Check-In、Check-Out 等,并将触发规则设置为 {{url}} 时,即表示确认。您已经在电子商务跟踪中传递了宏的值,因此 GTM 将能够在您发送时引用这些值。

其中只有一个是必需的,我要做的是在 Universal Analytics(测试版)Track Type = Transaction 上传递自定义维度/指标(假设这是您用来将电子商务信息传递给 GA 的方法)并添加自定义维度/指标(在“更多设置”>“自定义维度/自定义指标”下。

让我知道这是否有意义。乐意效劳。

于 2013-09-05T16:27:05.100 回答
0

检查页面上的谷歌标签,如果它是双重的,那么值将被双重计算。您将不得不采取其中一个代码。因此,在这种情况下,触发规则是双重触发的。- 布平德·科利

于 2014-07-10T10:23:05.837 回答