Kory
Kory

Reputation: 467

Detecting auto-translation event in Microsoft Edge

I'm currently expanding the type of data my nonprofit collects via Google Analytics/Tag Manager relating to website visitors accessing automatically translated versions of our website. I have a some javascript that detects when people using Google Chrome have our website auto-translated (there's a class and "lang" attribute added to the element in the DOM).

<html lang="en" class="translated-ltr">

I am trying to do something similar for Edge because I know that it has a similar auto-translation extension called Translator. Does anyone know if Edge's auto-translation causes any mutations or changes to the DOM when it translates a webpage?

enter image description here

Upvotes: 3

Views: 2622

Answers (1)

Yu Zhou
Yu Zhou

Reputation: 12999

I checked some websites in Edge Chromium and I found that after translation these attributes: _msthash="149916" _msttexthash="64220390" _msthidden="1" will be added in <title> element. The values of _msttexthash are different, the others are the same in different browsers.

So I think you can check _msthash="149916" or _msthidden="1" in <title> element to detect if people are using translator in Microsoft Edge Chromium.

enter image description here

Upvotes: 2

Related Questions