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:
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.
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!