Analytics
2K members online now
2K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Sending Language data via dataLayer while having class only

Follower ✭ ☆ ☆
# 1
Follower ✭ ☆ ☆

Hello, hope you're doing great! Smiley Happy

 

Here's my issue:

 

1. I need to track information about language usage (to split data by users' language) in personal profile. For most of our website pages we use language directories, but this option is impossible for profile.

2. I believe the best way to split data by languages is setting up a custom dimension

3. There's unique style for the line clicking on which allows to choose language:

<span class="selecter-item selected" data-value="Deutsch">Deutsch</span>

4. dataLayer is being generated after choosing language - http://prntscr.com/bxp4su .

 

 

Still I can't clear out how to set dataLayer based variables tracking for this issue. 

I'll be very grateful for any advice.

 

Thank you in advance

 

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Anna A
August 2016

Re: Sending Language data via dataLayer while having class only

Follower ✭ ☆ ☆
# 5
Follower ✭ ☆ ☆
Thank you for your assitance. Finally we decided to push profile langage data through dataLayer variable Smiley Happy

View solution in original post

Re: Sending Language data via dataLayer while having class only

Top Contributor
# 2
Top Contributor

Hi, Anna A,

 

I presume you're using GTM since you mentioned dataLayer. So I believe you are wanting to track the language selected based on the click. One method would be to use the data-value attribute with an auto-event variable:

 

Screenshot - 7_26_2016 , 8_01_07 AM.png

 

That would return the value "Deutsch" which you could then use to populate your Custom Dimension.

 

Hope this helps.

 

 

Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn

Re: Sending Language data via dataLayer while having class only

Follower ✭ ☆ ☆
# 3
Follower ✭ ☆ ☆
Hello.
Thank you for your assistance, though the option didn't work.

I think I'd better set variable for special gtm.elementClass (it is pushed to dataLayer), as soon as I find out how to set variable for specific Class, not ot all of them.

Re: Sending Language data via dataLayer while having class only

Top Contributor
# 4
Top Contributor
Hi, Anna,

It's likely that you didn't click directly into the "span" element itself. The Auto Event Variable works by looking at the exact element that was interacted with. In the dataLayer screenshot you provided, if you clicked into the gtm.element object, you should be able to see the list of attributes that were part of that clicked element. That's how the AEV variables work, by returning the properties of the clicked element.
Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn
Marked as Best Answer.
Solution
Accepted by topic author Anna A
August 2016

Re: Sending Language data via dataLayer while having class only

Follower ✭ ☆ ☆
# 5
Follower ✭ ☆ ☆
Thank you for your assitance. Finally we decided to push profile langage data through dataLayer variable Smiley Happy