- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
07-19-2018 08:27 AM
Hello,
I'm planning to track a few pdf generated by our website once the user clicks of of 10 different buttons. Every click on a different button should be identified by a variable that records the "document name" and another variable that I will populate with "pdf_download" everytime and I'll pass it to a sitecatalyst event. So we would have something like pdf_name='new quote' and event_name='pdf_download'
The tricky part is to assign a pdf_name as the elements (buttons) are not really named in a proper way and I can't use page name either as some pages have got several buttons on it.
I was thiking about 2 options:
1. use a jquery extension and populate the pdf_name variable with pagename+jquery selector name (so I could create a unique id for the button)
2. use a js extension so i can write all the cases I need to use in just one code (something like: if pagename=... and jquery=... then page_name="new quote" else if...). This is a way cleaner option I guess but I heard it's not the best in terms of audit (as I've told to use extensions rather than js code)
Any advice is welcome
Thanks
Solved! Go to Solution.
07-23-2018 12:26 PM
Hello @Davide
Assuming that your pages are static my recommendation would be to use Jquery extension with xpath as your selector which is unique for each element. It will be easy to set both pdf_name and event_name in the same extension for one pdf which will be easy for documentation (in future if you want to modify you don't have to work with a big JS extension)
Hope it helps
Thanks!
Copyright All Rights Reserved © 2008-2023