Accessing hitcount outside of Hit Count Listing Page


(Ryan Morgan) #1

Hi there,

 

Can anybody shed light on how one would access %asset_hitcount% outside of an hit count listing page.

 

I am using it in conjunction with triggers and the API to create a way to "like" pages. Works great except I would like to be able to access the number of likes (hits) across paint layouts etc.

 

I've tried: keyword modifiers, globals, nesting hit count listing page (trying to group by parent - then access parents hitcount).

 

Don't want to use metadata values for this - if too many people like something the increments and decrements will be nasty.

 

Thought it would be a great way to leverage an existing data attribute.

 

Cheers in advance.

R


(Peter McLeod) #2

Hi

 

There is probably a simpler way...

 

As you can't (well I don't think you can) use a dynamic paramter to list a specific asset with a hit count listing, you could set the listing up to return hit data in JSON format for all assets (just need to make sure this is set up to properly return JSON data).

 

Then use REST asset to access the data the RESTJS find and print/return the hit count for an individual asset that you would supply to the REST asset when calling it (eg pass the asset ID you want hits for to the REST asset through a GET parameter).

 

Thanks

Peter


(Ryan Morgan) #3

Thanks Peter,

 

I think that'll do it. Wish there was a less convoluted way, but until that day comes I'll give this a crack.

Cheers, R