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
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,607 views 4 13
Read article

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