How can I send a request for a dynamic URL which depends on a page's Title

I want to gather statistics on the usage of the pages in my space (..and not with the native statistics tools) using a cgi script .

In order to do so, I need that upon entrance to each of the pages in my Space- an automatic request will be sent to a URL that part of its address is the name of the page the user entered.

 

 

For example:

If the page's title is:

great Lion

then I want that upon every entrance to this great Lion page,

the server will send a request for the next address:

http://sde-cgi..../.....pl?....;tag=PAGE:great Lion &ver=1.jpg

 

Thanks for @Stephen Deutsch, I was able to advance with this, but I still need help.

 

Here's what I was able to achieve so far: 

While inside an HTML macro, the next lines of Java extract the name of the page I'm in:

<script>
var title;                 //the variable that will have the title
//of the page i'm in. var func = function() { console.log('func loaded'); AJS.toInit(function() { console.log('toInit loaded'); AJS.$(document).ready(function() { console.log('ready loaded'); title=AJS.params.pageTitle console.log(title);   }); }); }; func(); </script>

But it won't try to reach the URL, while the next line of code which I've put in a different HTML macro- reaches the URL but isn't able to automatically generate the full name of the page I'm in (you need to give it the name manually)

<img src="http://....pl?...;tag=PAGE:great Lion&amp;version=1.0.jpg">

the next link holds a good answer that almost helped me, but the issue with it is that it couldn't give me the full name( it returned the name until the first space) and it didn't try to reach the URL upon the loading of the page (you had to enter another link in order for it to load).

 https://community.atlassian.com/t5/Confluence-questions/How-can-i-extract-automatically-the-name-of-the-page-i-m/qaq-p/624113#M83657

 

Hope that someone will be able to solve this puzzle...

Thanks...

 

-lee.

 

0 answers

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

982 views 23 13
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you