Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

le tu August 15, 2017

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
TAGS
AUG Leaders

Atlassian Community Events