Mobile app version of vmapp.org
Login or Join
Samaraweera270

: How do I track automatic translation of web page? My web site is posted in English. I do not have the Google Translate plugin installed, nor do I have any plans to install it. However, I'm

@Samaraweera270

Posted in: #EventTracking #GoogleAnalytics #GoogleTranslate #Translation

My web site is posted in English. I do not have the Google Translate plugin installed, nor do I have any plans to install it. However, I'm inferring from some of my analytics data that people visiting my web site are using Google Translate to translate my pages. I presume they're visiting my site and seeing Google's "This page is in English. Would you like to translate it to [their language]?" and clicking "Translate".

Is there any hook in Google's automatic translation, e.g. some event fired, that I can use to detect these automatic translations and fire a Google Analytics event tracking the translation and hopefully capturing the language they're translating to? Note: I've seen this post, but the answer refers to the plugin, which I'm not using. I want to track when Google volunteers to translate automatically.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Samaraweera270

2 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

The Google Translate Toolbar only appears to send analytics events for the old (non-universal) analytics. I developed the following workaround. Just:


Ensure you set gaTrack: true and gaId: 'xxx' in your translation toolbar settings
Include the below script on your page alongside the translate snippet

/*!
* Capture Analytics for Google Translate
* As of 2016, the Google Translate toolbar still only works with the old-style analytics (ga.js)
* The code below mocks the old analytics object, captures the events and passes them to the new Universal Analytics (analytics.js)
*
* Source: webmasters.stackexchange.com/a/101787/18749 * Copyright (c) Simon East 2016, for yump.com.au
* Free to use under MIT licence <https://opensource.org/licenses/MIT>
*/
window._gaq = {}; window._gat = {};
window._gat._getTracker = window._gat._getTrackerByName = function(){ return {
_trackEvent: function(eventCategory, eventAction, eventLabel) {
// [0] will send the event to the first analytics ID on the page (in case you have multiple)
if (window.ga && ga.getAll()[0]) {
ga.getAll()[0].send('event', eventCategory, eventAction, eventLabel);
window.console && console.log('Translation event sent to Google Analytics:', eventCategory, eventAction, eventLabel);
} else {
window.console && console.warn('Could not locate Google Analytics when attempting to log translation events.')
}
}
}}

10% popularity Vote Up Vote Down


 

@Angela700

I'm not finished with this yet as I'm sure we'll be able to get this set up as event tracking eventually but here is one way that may help/give you what you want for now...

In Google Analytics:-

Audience > Geo > Language


Primary Dimension: Language
Secondary Dimension: Hostname


Select advanced filter and set this to include hostname translate.googleusercontent.com like the below screenshot demonstrates:-



This will then show you all instances where Google Translate has been used to translate content on your website along with their detected language.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme