Analytics
1.8K members online now
1.8K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

Storing Arrays/Objects in Custom Dimensions for Enhanced Ecommerce

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello, just been trying to set up Enhanced Ecommerce on my website, and I'm wanting to collect some information that's stored as arrays and as objects, something like this:

 

<script>
dataLayer.push({
    "event": "transaction",
    "ecommerce": {
        "currencyCode": "AUD",
        "purchase": {
            "actionField": {
                "id": "T123456",
                "revenue": 25.00,
                "tax": 2.27,
                "coupon": "",
            },
            "products": [{
                "name": "",
                "id": "BOOK-001-A1",
                "price": 25.00,
                "brand": "Puffin",
                "category": "Horror",
                "variant": "",
                "quantity": 1,
                "coupon": "",
                "dimension10": [
                    "a",
                    "b",
                    "c",
                    "d"
                ],
                "dimension11": {
                    "a": true,
                    "b": true,
                    "c": false
                }
            }]
        }
    }
});
</script>

I've got dimension10 and dimension11 set up as custom dimensions and their scope is set to Product, and that's alright, however when I look into the event in GA, it shows dimension11 as [object Object], and when I look for that same event in BigQuery, the dimension11 field shows null. I'm just wondering if it's possible to send and object through a custom dimension, or will I have to do some sort of roundabout thing to get it working (like converting the object to a string and sending that instead?). I'd like to see:

dimension11 { "a": true, "b": true, "c": false }

inside of BigQuery.

 

Thanks!

2 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Ciaran B
November 2015

Re: Storing Arrays/Objects in Custom Dimensions for Enhanced Ecommerce

Top Contributor
# 2
Top Contributor
Hi,

for dimension11 you'll have to pass it as concatenated string e.g. a-true/b-true/c-false as you can see the hit itself will pass the cd11 as pr1cd11=%5Bobject%20Object%5D.

Kind regards,
Zorin
Web analyst @ escapestudio.net

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Ciaran B
November 2015

Re: Storing Arrays/Objects in Custom Dimensions for Enhanced Ecommerce

Top Contributor
# 2
Top Contributor
Hi,

for dimension11 you'll have to pass it as concatenated string e.g. a-true/b-true/c-false as you can see the hit itself will pass the cd11 as pr1cd11=%5Bobject%20Object%5D.

Kind regards,
Zorin
Web analyst @ escapestudio.net

Re: Storing Arrays/Objects in Custom Dimensions for Enhanced Ecommerce

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Is there any reason in particular why I can see the test transaction I performed, and it shows dimension "a,b,c,d" in GA, but when I look my BigQuery results, the same custom dimension is shown as null? Does GA not send the proper information to BigQuery if the custom dimension is at product scope?

Re: Storing Arrays/Objects in Custom Dimensions for Enhanced Ecommerce

Top Contributor
# 4
Top Contributor
In bigquery it is stored as hits.product.customDimensions.value so it is maybe just a mixup with the custom dimension of a diferrent scope?

Kind regards,
Zorin
Web analyst @ escapestudio.net

Re: Storing Arrays/Objects in Custom Dimensions for Enhanced Ecommerce

Top Contributor
# 5
Top Contributor
If the custom dimension is passed along a product call, it needs to be defined at the property level as a product-scope custom dimension.
If the dimension is set to session- or hit-scope , it will not register.
VP & Chief Evangelist at Hub'Scan | Contact me
Level 80 Digital Analytics Warrior, KPI Therapist and Keeper of the One True Tagging Plan

Re: Storing Arrays/Objects in Custom Dimensions for Enhanced Ecommerce

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭
You are a legend, I couldn't understand why I could see it in GA but not in BQ but this is the reason why! Thanks!

Re: Storing Arrays/Objects in Custom Dimensions for Enhanced Ecommerce

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
Yeah I had already set up some new custom dimensions and metrics as product-scope so I could keep the existing hit-scope dimensions and metrics available while I work on this! Smiley Happy