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

Setting up a destination goal for a website with a different URL.

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Is it possible to set up a destination goal for websites with a different URLs. I am trying to track how many people view my homepage and then click on my ordering website, but the two websites have to totally different URLs.  

1 Expert replyverified_user

Re: Setting up a destination goal for a website with a different URL.

[ Edited ]
Top Contributor
# 2
Top Contributor

Hi Freestyle M :-)

You can use events to track clicks on the outbound links,

To do this.. add the following code to the link itself (entering your url details etc to replace the example code)

 

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

and then add the following code before the closing </body> tag on the same page

 

<script>
/**
* Function that tracks a click on an outbound link in Google Analytics.
* This function takes a valid URL string as an argument, and uses that URL string
* as the event label. Setting the transport method to 'beacon' lets the hit be sent
* using 'navigator.sendBeacon' in browser that support it.
*/
var trackOutboundLink = function(url) {
   ga('send', 'event', 'outbound', 'click', url, {
     'transport': 'beacon',
     'hitCallback': function(){document.location = url;}
   });
}
</script>

Reference:
https://support.google.com/analytics/answer/1136920?hl=en

If you have further questions or need further help, pls post back :-)

Thanks

Bronwyn

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here