Forum Discussion
Claudius
12 months agoBoss
A lot of the user information necessary for analytics and tracking is actually exposed within the LITHIUM.CommunityJsonObject object so no need to resort to Freemarker. I would recommend to explore the content of this object as easily as just querying it in your Web Developer console.
For Google Analytics you might do something like the following on your skin's head wrapper:
analytics.ready(function() {
if(LITHIUM.CommunityJsonObject.User.registered){
if(!analytics.user().traits().email){analytics.identify({'email':LITHIUM.CommunityJsonObject.User.emailRef})};
}
});
Also if you truly find that you indeed need to expose some additional Freemarker context object information to the JavaScript on client side you could maybe do something hacky like this untested code:
<@liaAddScript>
var userName = ${user.login};
</@liaAddScript>
Related Content
- 3 months ago
- 5 years ago
- 2 years ago
- 2 years ago