: 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
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.
More posts by @Samaraweera270
2 Comments
Sorted by latest first Latest Oldest Best
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.')
}
}
}}
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.