Hi,
I added a comment to question https://answers.atlassian.com/questions/216457 but it's gone now, so I'll make it a whole new question.
I've tried the code Remo Siegwart gave, but it didn't do what it supposed to do. Now I'm doing this for the first time so I'd like some help with it.
As you said, I've added it after the body, here's my code:
<body #onLoadAttr() id="com-atlassian-confluence" class="#if ($darkFeatures.isFeatureEnabled("lighter-editor-v1")) lighter-editor #end $!theme.bodyClass $!sitemeshPage.getProperty("page.bodyClass") aui-layout aui-theme-default">
<div class="wiki-content">
$body
$helper.renderConfluenceMacro("{viewtracker}")
</div>
But now my Dashboardpage repeats itself with a error: "Error formatting macro: viewtracker: java.lang.NullPointerException" Other pages don't show any difference.
After that, I've tried it after the body, at the end, because that's also a way to understand what you mean, so my code is this:
</body>
<div class="wiki-content">
$body
$helper.renderConfluenceMacro("{viewtracker}")
</div>
</html>
My Dashboardpage now has a very ong empty space underneath it with again the error: "Error formatting macro: viewtracker: java.lang.NullPointerException". Other pages don't show any difference.
I don't know what to do next, any help?
Hi Vera,
Both of your attempts are not correct. The only thing you need to do is to paste the line
$helper.renderConfluenceMacro(
"{viewtracker}"
)
right after the velocity variable $body
(not the body HTML tag). The rest of the code you leave unchanged.
I recommend that you first reset the whole page layout and start again. Make sure you use the page layout and not the global layout. Atlassian documentation: Customising Site and Space Layouts
I hope this helps.
Regards,
Thomas
Hello, Thank you for your quick help. I was wondering if I was editing the right Layout: I did Main, but I'm no thinking I have to have Page Layout? And if so, which $body should I use? Because there are 3... Sorry & thanks again!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You have to use the page layout. → Confluence Administration → Layouts (under Look & Feel) → Create custom (Page Layout under Content Layouts) In the page layout you will find a $body variable in a HTML div. You'll have to add the Viewtracker macro there: <div id="main-content" class="wiki-content"> $body $helper.renderConfluenceMacro("{viewtracker}") </div> Please refer to the [Viewtracker add-on documentation FAQ|https://wiki.bitvoodoo.ch/display/DOC/Viewtracker+Plugin#ViewtrackerPlugin-FAQ] as well, expand the question "How can I include the Viewtracker macro on every page?" Kind Regards, Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas, Found it, added it and it works. 2 questions, to be sure: 1. It's only possible with the default theme, i think? 2. Is is possible to hide it with e.g. the Show if Macro?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vera, 1. Most likely yes. Themes do bring their own layout templates that overwrite the one you configured in Confluence. I'm not entirely sure that if a theme does not contain a template for the page layout, your customisations to the page layout might still work but this is not the case with the documentation theme that ships with Confluence. However, you could have a look at the Enterprise Theme, with which it would be much easier to include the Viewtracker macro on every page: * https://marketplace.atlassian.com/plugins/net.getunik.confluence.skin.core * https://wiki.bitvoodoo.ch/display/DOC/Sections 2. If you hide the Viewtracker macro with the show-if macro (e.g. show it only to Confluence administrators) then you would only count the views of those administrators. The proper way to use the Viewtracker macro and the show-if macro is described as well in the Viewtracker dokumentation FAQ (https://wiki.bitvoodoo.ch/display/DOC/Viewtracker+Plugin#ViewtrackerPlugin-FAQ), expand the question "How can I make the Viewtracker macro only visible to administrators?" In your case the line you would want to insert into the page template would look like this (everything has to be on one line even it will most likely have a line break here in my reply!): $helper.renderConfluenceMacro("{viewtracker:hide=true}{show-if:group=confluence-administrators}{viewtracker-report}{show-if}") Kind Regards, Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We've updated the documentation for this:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And starting with version 5 we built in a feature allowing tracking on all pages without the need of putting the macro on every page. Just as addition. :)
Check out our Administrator's Guide.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello all!
It works and it only shows to administrators. BUT.... only on the highest level, not on child-pages and child-child-pages....
How come and how to fix? Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry just to clarify, I am wanting to add the viewtracker plugin to one particular training manual in one space. Do I have to manually add it to every page or is there a workaround? Thanks again
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Is it possible to do this using the documentation theme, and how? Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, tried that, not possible in Doc theme. But you can change the way the sidebar looks so it looks almost the same as in the doc theme.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.