Tracking mobile users on Confluence while using Refinedwiki mobile theme is not possible or straightforward using theme configuration. I found a work around that will track users on Google Analytics smoothly. Please follow the below steps:
- Create a js file, call is analytics.js with the analytics script code, it should look something similar to the below:
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXX', 'auto');
ga('set', 'userId',AJS.Data.get("remote-user")); // Set the user ID using signed-in user_id.
ga('send', 'pageview'); - Save your script on confluence server confluenceInstallationDirectory/confluence/ OR install it on any other location that can be access via http or https
- Go to confluence administration and click on User Macros on the left menu.
- Click on Create a User Macro
- Now set up per the below photos:
- Save and go to refind wiki mobile theme and click on Macro Render Rules, then click Add Macro Render Rule. On choose macro select Mobile Tracking. Click Save.
- Now go to refind wiki mobile theme configuration, in the footer add the wiki code: {mobiletracking} then save.
This helped me to solve another problem with the mobile theme as well. Thanks for sharing!
ReplyDelete