1
votes

With Google Universal Analytics you can send custom metric in two ways:

1) Attached to a specific hit

ga('send', 'pageview', {
  'metric1':  1
});

2) Or you can set custom metric globally, so the custom metric will be send with all the hits on the page.

ga('set', 'metric1':  1);

In this second case, every hit of the page (eg: an event) will add a value 1 to the custom metric metric1.

In google Tag Manager you can set custom metric in the configuration panel, but this set a "global" custom metric: every hit on the page will increment the given metric (case 2).

Is there a way to send a single metric with a pageview in Google Tag Manager (like in case 1)?

2

2 Answers

0
votes

In Google Tag Manager, you can create a Tag that will send Pageviews and also have it set Custom Metrics at the same time.

To configure the Tag, set:

  • Track Type to Page View
  • Twirl down More settings
  • Twirl down Custom Metrics
  • Click + Add Custom Metric
  • Set your Metric Index and Value
0
votes

@Francesco Create a user-defined variable and name it "custom metric1". Set it to type "Lookup Table", input Value "{{url path}}". Add the path to the pages you want it to fire on as inputs, set the output as "1", and define a default value of "0".

Now set the custom metric in your GA tag like Philippe described but make sure to set the metric value to {{custom metric1}}.

The custom metric is now always added but adds "0" to pages you are not listing in the lookup page.