Analytics
1.7K members online now
1.7K 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

Click event tracking using more than 3 dimension shown on reports?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi all,

 

I want to achieve to show multiple custom dimensions in customized reports on click event, for example below I have five columns (dimensions)

 

1.  Book Title

2.  Book Language

3.  Book Author

4.  Date Published

5.  Website

 

Should I create those dimensions as Hits type?

Should I be using dataLayer to create those 5 objects in the <script> section?

How should I pass this on a <a href="" > tag?

 

Thanks..

2 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Victor C
June 2016

Re: Click event tracking using more than 3 dimension shown on reports?

Top Contributor
# 4
Top Contributor

Hi Victor,

 

Please try this working example below.

Your page with the function that fires the dataLayer on the promotion link click:

 

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-NFB8LF"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<!-- End Google Tag Manager -->
<script>
 
function promoClick() {
  dataLayer.push({
    'event': 'promotionClick',
    'ecommerce': {
      'promoClick': {
        'promotions': [
         {
            'id' : 'PromoID_1234',
			'name' : 'Summer Sale June 10 2016',
			'creative' : 'summer_banner2',
			'position' : 'somewhere_out_there'
         }]
      }
    },
      'eventCallback': function() {
       document.location = 'product-page.html';
    }
  });
}
</script>
</head>
<body>
<a href="#" onclick="promoClick();">Promo Click</a>
</body>
</html>

You need to create your Universal Analytics tracking tag that will capture the event like this:

 

Tag type : Universal Analytics
Track type : Event
Event Category: Ecommerce
Event Action: Promotion Click
Enable Enhanced Ecommerce Features: true
Use Data Layer: true
More settings > Fields to Set: select the field name {{url path}}
Fire On: custom event name promotionClick

 

Hope this helps, let me know if you have any questions.

 


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

View solution in original post

Re: Click event tracking using more than 3 dimension shown on reports?

Top Contributor
# 2
Top Contributor
Hi Victor,
What you're trying to do doesn't make sense. The dimensions you're looking to add as custom dimensions are product level and must be set at the product level scope.
You can only set a product scoped custom dimension when enhanced ecommerce tracking is setup. I believe this is what you're trying to do.

I would go the enhanced commerce setup route before trying to stick in these custom dimensions into a hit level scope as it's not where they belong.
You can find more information about this here: https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce

Re: Click event tracking using more than 3 dimension shown on reports?

[ Edited ]
Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi Dave,

Many thanks for your suggestion! I didn't know there's such a thing as Enhanced Ecommerce tracking! Actually my goal was to track internal promotion clicks so this is perfect.

Just a few questions tho.. I have setup everything but I couldn't see this event ec:setAction promo_click being sent to GA in real time event view. Did I missed something?

This is how I set it up:
1. Created a Tag "EEC - DataLayer - Initialize", with a custom HTML below to set dataLayer values that I want to capture later on. This is Triggered when the page loads.

&lt;script type="text/javascript">
(function() {
dataLayer.push(
'ec:addPromo', {
'id' : 'PromoID_1234',
'name' : 'Summer Sale June 10 2016',
'creative' : 'summer_banner2',
'position' : 'somewhere_out_there'
}
);
})();
&lt;/script&gt;

2. Then I setup another Tag "EEC - DataLayer - Process" with a Trigger Click event such as when a class "eec_transaction" is apparent. In here I used track type as Transaction.
3. In the web page hyperlink, I do a dataLayer.push to initiate the transaction.
<a href="welcome_home.html" class="eec_transaction" onclick="dataLayer.push('ec:setAction' : 'promo_click');dataLayer.push('send' , 'event', 'Internal Promotions', 'click', 'Summer Sale')">TEST - EEC</a>

Result is I couldn't see the click event captured in the real time statistics. Can you please advise?

Thanks again

 

EDIT: I forgot to mention that I have enabled Enhanced Ecommerce in GA too for this view that I am using.

Marked as Best Answer.
Solution
Accepted by topic author Victor C
June 2016

Re: Click event tracking using more than 3 dimension shown on reports?

Top Contributor
# 4
Top Contributor

Hi Victor,

 

Please try this working example below.

Your page with the function that fires the dataLayer on the promotion link click:

 

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-NFB8LF"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<!-- End Google Tag Manager -->
<script>
 
function promoClick() {
  dataLayer.push({
    'event': 'promotionClick',
    'ecommerce': {
      'promoClick': {
        'promotions': [
         {
            'id' : 'PromoID_1234',
			'name' : 'Summer Sale June 10 2016',
			'creative' : 'summer_banner2',
			'position' : 'somewhere_out_there'
         }]
      }
    },
      'eventCallback': function() {
       document.location = 'product-page.html';
    }
  });
}
</script>
</head>
<body>
<a href="#" onclick="promoClick();">Promo Click</a>
</body>
</html>

You need to create your Universal Analytics tracking tag that will capture the event like this:

 

Tag type : Universal Analytics
Track type : Event
Event Category: Ecommerce
Event Action: Promotion Click
Enable Enhanced Ecommerce Features: true
Use Data Layer: true
More settings > Fields to Set: select the field name {{url path}}
Fire On: custom event name promotionClick

 

Hope this helps, let me know if you have any questions.

 


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: Click event tracking using more than 3 dimension shown on reports?

[ Edited ]
Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hi Arnold,

Thanks so much for providing the script! I applied your example to my site and I can see that the event promotionClick triggered, and when I bring up my developer console I can see that those ecSmiley Tongueromo "1" id (&promolid) etc got pushed through successfully. Does it mean that I will see the data in GA after a day or so?

A few more questions:
1. In the more settings above, I'm not sure as I can't find the {{url path}} under Field Name? and should Value be {{Click URL}} ?
2. How long does it usually takes for the promotion data to be get posted in GA>Conversions>Marketing>Internal Promotion?

Re: Click event tracking using more than 3 dimension shown on reports?

Top Contributor
# 6
Top Contributor

Hi Victor,

 

Yes, the data should appear in GA if you can see it in the console.

 

I made a mistake above it seems, it should be:
More settings > Fields to Set: select the field name page and value {{url path}}

 

As the other ecommerce data, promotions should appear in a few hours in the reports.

 

Let me know if you have more questions.


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: Click event tracking using more than 3 dimension shown on reports?

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
Many thanks again, much appreciate your help!

I have another question about Internal Promotion Views not getting posted to the GA. I opened up a separate topic below. It would be great you can give some advice on that too?
https://www.en.advertisercommunity.com/t5/Code-Implementation/Enhanced-Ecommerce-Promotion-Impressio...