Extracting the user and message metadata via JavaScript
Hello,
I wanted to confirm the best approach for extracting message and user metadata from a forum page. This would be done via JavaScript. The purpose of this is for capturing analytics data.
The metadata required is as follows:
1. User rank
2. Message ID
3. Message lifespan
I am not sure if I should place a component that makes REST API calls to obtain the values listed above or if it is possible to extract the metadata from the page contents.
For example, http://lidemo.lithium.com/t5/Speakers/Amazing-sound-from-my-Xs3/td-p/2713
By checking the Page Source, I see the user rank and message ID in the following markup:
<div class="lia-user-rank">Trusted Contributor</div>
<input value="2713" id="form_instance_key" name="form_instance_key" type="hidden"></input>
<input class="lia-form-message-uid-key-input" value="2713" id="lia-message_uid_key" name="message_uid_key" type="hidden"></input>
Are these reliable areas to use for extracting the data? Or are these not always consistent.
For message lifespan (e.g. "Two weeks ago"), this appears as plain text. Is there a way to retrieve the message lifespan as a precise data. It looks like the REST API would work:
http://lidemo.lithium.com/restapi/vc/messages/id/2713/post_time
So I would need to add a component which adds this REST API call to the page. Does this sound like the right approach?