dimanche 29 novembre 2015

How to track a user clicking on a link to a document

I'm trying to keep track of when my user clicks on a link to a pdf document. I want to store this click as a view in an already existing views table in my sqlite database but I am unsure how I can register that a link to a document has been clicked on.

In the HTML, this is how I refer to the document which is in table format:

<td><a href="/static/resumes/{{row[2]}}">{{row[2]}}</a></td>

I'm using python with flask so I think I could normally make a function for that url and then just add to the views table with the session['user'] whenever that document is viewed, BUT these documents are user created and and will have random names so I'm not sure how I can account for that since I am just opening up a pdf document.

Here is an example of how I would like the python code to work(may or may not be helpful):

@app.route('/Employer/foo')
def updateView():
    addUserToView(session['user'])
    return render_template('foo.pdf')

Again I'm just not sure how to keep track of the pdf link

Thanks for any help

Aucun commentaire:

Enregistrer un commentaire