AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

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

How can I rename onclick="trackOutboundLink to anything else?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi all,

 

I have a quick question please. My workflow is as follow:

 

User click on my Adword banner and arrive on my website, from there, I would like them to click on a link that sends them to a third party website for registration.

 

I wanted to monitor how many people from click on Adwords actually click(convert) on the third party website link.

 

What I did till now is add some code in the header and this in my links:

onclick="trackOutboundLink("name here").

 

All I need to know is, can I rename "name here" to anything I like or does this has to be the link I am monitoring as I would like to have some kind of description rather than url in my reports.

 

Thank you for your help..

 

Lor.

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author lorraine r
July 2017

Re: How can I rename onclick="trackOutboundLink to anything else?

Top Contributor
# 2
Top Contributor

Hi,

 

You can modify the code you put into the header to accept another parameter that you will use for the description:

<script>
var trackOutboundLink = function(url,desc) {
   ga('send', 'event', 'outbound', 'click', desc, {
     'transport': 'beacon',
     'hitCallback': function(){document.location = url;}
   });
}
</script>

 

Then you can add description to the links like this:

<a href="http://www.example.com" onclick="trackOutboundLink('http://www.example.com','description here'); return false;">Check out example.com</a>

Hope this helps, let me know if it works for you.


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

Marked as Best Answer.
Solution
Accepted by topic author lorraine r
July 2017

Re: How can I rename onclick="trackOutboundLink to anything else?

Top Contributor
# 2
Top Contributor

Hi,

 

You can modify the code you put into the header to accept another parameter that you will use for the description:

<script>
var trackOutboundLink = function(url,desc) {
   ga('send', 'event', 'outbound', 'click', desc, {
     'transport': 'beacon',
     'hitCallback': function(){document.location = url;}
   });
}
</script>

 

Then you can add description to the links like this:

<a href="http://www.example.com" onclick="trackOutboundLink('http://www.example.com','description here'); return false;">Check out example.com</a>

Hope this helps, let me know if it works for you.


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

How can I rename onclick=&quot;trackOutboundLink to anything else?

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thank you so much, this will help me greatly!