javascript - Double-Counting Custom Metrics in Google Tag Manager/Universal Analytics -


i manage analytics hotel/resort site contains 8 distinct properties, on single domain each property has own subdomain. there's splash page @ www.example.com links other properties, , properties located on property1.example.com, example. should mention we're using universal analytics nestled cozily within google tag manager container.

the problem transactions custom metrics being multiplied. 95% of purchases single-room, what's being reported in ga not match our back-end data. please note how adults metrics numbers:

metrics double counting or more

to further complicate issue, using custom html script dynamically sets corresponding property id using 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 ua-xxxxxx-1, property1 ua-xxxxxx-2, property2 ua-xxxxxx-3, , forth. rollup property contained within separate tag individual properties because needs fire in tandem property-level tag; fires on pages.

we're using datalayer define 5 custom metrics , 6 custom dimensions. these variable pairs first set using natural language (i.e. check-in date), converted corresponding metric or dimension (i.e. dimension1) using custom html tag.

here example of 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 , 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 script have maps natural language definitions 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, have universal analytics pageview tag fire off these custom metrics & dimensions. rules tag are: confirmation url, , event = init. pushing metrics & dimensions

i provide more details if needed, fear may have lost of already. think problem relates custom tags, or how custom metrics & dimsensions being pushed ga server. help!

calling ga('set', {your dimensions here}) should tell universal analytics send data in on every hit life of tracker object (i.e. until new page loaded). so, if you've got pageview , transaction sent on same page voila - double metrics.

a quick way check if problem create custom report of transactions , see if of custom dimensions / metrics associated hit.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -