1
votes

I am currently trying to send custom dimension values with the product impressions event. Everything else seems to work but I am not able to report on the custom dimension values.

I have set up dimension8 and dimension 9 for star rating and review count. I have passed through these values to the object and it is successfully being sent.

dataLayer.push({
    'event': 'productDetailImpressions',
    'ecommerce': {
        'detail': {
            'actionField': {
                'list': 'PDP'
            },
            'products': [{
                'name': name,
                'id': id,
                'price': price,
                'brand': brand,
                'category': category,
                'variant': variant,
                'dimension8': reviewCount,
                'dimension9': starRating
            }]
        }
    }
});

I have set these custom dimensions up with product scope in GA.

I can view the tag and the information it is sending with a plugin in the browser, the values look correct.

However I am still not able to report on these values inside Google Analytics.

Is there anything I am doing wrong?

Thank you.

1
Did you build a custom report in GA or alternatively did you add the custom dimensions as a secondary dimension to an existing, standard report?faridghar
I added the custom dimensions as a secondary dimension to an existing report, standard report. I believe some results are coming through now. Possibly has been very slow to come through. Will confirm tomorrow.Millicano

1 Answers

1
votes

The scoping of dimensions required 2 things:

Configure scope in Google Analytics admin interface
See below screenshot: enter image description here

Send custom dimension with the proper hit
Data is sent to Google Analytics with "hits". Hits are:

  • page tracking hits
  • event tracking hits
  • ecommerce tracking hits social
  • interaction hits

Now this doesn't mean that you should structure your dataLayer so that the custom dimensions are on the same level ase the object (eg user, product) you're trying to associate them with. Instead, you should follow the standard method for setting dimensions:

In Google Analytics, it is:

// Set the dimension
ga('set', 'cd1', 'Level 1');
// Send custom dimension along with a hit (eg pageview)
ga('send', 'pageview');

Now with Google Tag Manager, GTM doesn't send any hits to Google Analytics, it's just a tool for preparing your data and automating the use of GA. So an example on how to do it:

dataLayer.push({
    'event': 'productDetailImpressions',
    'dimension8': reviewCount,
    'dimension9': starRating,
    'ecommerce': {
        'detail': {
            'actionField': {
                'list': 'PDP'
            },
            'products': [{
                'name': name,
                'id': id,
                'price': price,
                'brand': brand,
                'category': category,
                'variant': variant,
            }]
        }
    }
});

Then create some dataLayer variables to read the custom dimension values:

enter image description here

Finally, assign those dimensions to your GA tags:

enter image description here

note: you could potentially make it work with the dataLayer you have, you would just have to replace your dataLayer variable to point to the right location, however I think it's bad practice because it leads to believe that dimensions have to be nested within the scoped object in order to work (which is not true) and it makes things harder to debug.