Universal Analytics Custom metrics

Silver Contributor
Silver Contributor


There is an extension we use to set SiteCatalyst Custom events (called “Setting custom events”) in our “web” profile. This extension sets various events with a simple u.addEvent and the event number from SC.

Example for event10:
if (utag.data["page_views_per_visit"] && utag.data["page_views_per_visit"] == 2) {

How do I do that for Universal Analytics? For the above example the GUA metric I want to set is “transaction-metric1”.

Many thanks...Jean-Marc


Universal Analytics Custom metrics

Employee Emeritus

There is probably more than one way to accomplish this, but here is one that will work.

1) Create a data source called gua_transaction_metric1.
2) In the Google Tag, map gua_transaction_metric1 to Event Type: transaction, Metric: metric1.
3) Create a Set Data Value Extension, Scope it to your Google Tag, Set gua_transaction_metric1 to any dynamic variable
with the condition: page_views_per_visit is defined and page_views_per_visit equals 2

Now by default gua_transaction_metric1 will not exist and so it will not map to your Google Tag. However if page_views_per_visit equals 2 then gua_transaction_metric1 will have the value you supply and will map to as well as pass along to your google tag.

Last the concept of a transaction metric in the Tealium template for Google Universal Analytics just means that this metric is only sent on pages where order_id has a value.

So in your specific case, order_id would need to have a value and page_views_per_visit would need to equal 2 for this to pass along to Google.


Let us know how this works for you.

Happy Tracking