Skip to main content
1-Visitor
December 6, 2022
Question

Google Analytics or Microsoft Clarity into Thingworx

  • December 6, 2022
  • 1 reply
  • 1236 views

Hi,

 

I would like to ask for suggestion to embed Google Analytics or Microsoft Clarity into ThingWorx.

 

Is it possible to do it via HTMLTextArea? 

1 reply

5-Regular Member
December 6, 2022

Hello @VacuumDecay 

 

Embedding Google Analytics is not a part of ThingWorx Functionality. However, you can do by following the article:

https://www.ptc.com/en/support/article/CS196516

 

Regards

Bhawna

 

 

 

 

 

1-Visitor
December 6, 2022

Hi @bchaudhary_448008 ,

 

Thank you for your reply! 

 

Is there any sample extension that uses Google Analytics? Should I put the Google Analytics snippet in *.runtime.js file? 

Can the "renderHtml" method accept "<script>"?  For example as below: 

 

this.renderHtml = function () {
// return any HTML you want rendered for your widget
// If you want it to change depending on properties that the user
// has set, you can use this.getProperty(propertyName). In
// this example, we'll just return static HTML
return '<!-- Google tag (gtag.js) --> ' +
' <script async src="https://www.googletagmanager.com/gtag/js?id=G-SSS"></script>' +
' <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag("js", new Date()); gtag("config", "G-SSS"); ' +
' </script>';
};

19-Tanzanite
December 6, 2022

Hi @VacuumDecay ,

I am not aware of any such extension, but probably it would be wise to search via Google to see if there is anything like this.

Documentation around creating widgets is available here: https://support.ptc.com/help/thingworx/platform/r9/en/index.html#page/ThingWorx/Help/Best_Practices_for_Developing_Applications/visualization_widgets_AddingCustomWidgets.html#

One of the sub nodes in there has the answer to your question.