Hack 73 Tally Topic Popularity

 < Day Day Up > 

figs/moderate.gif figs/hack73.gif

Organize PDF page hits by document headings to get a sense of what readers like best .

A single long document can cover dozens of topics. Which topics do readers find most useful? Use our PDF skins [Hack #71] to track hits to individual pages. Then, use our hit_report script to map these page hits back into your document's headings, as shown in Figure 5-19. You'll see topic hits, not ambiguous page hits. Visit http://www.pdfhacks.com/eno/ for an example.

Figure 5-19. hit_report showing hits by topic
figs/pdfh_0519.gif

Page hit logging is built into the pdfskins_classic_php template [Hack #71] . After unpacking this template, activate hit logging by editing script.include and setting $log_hits=true . You can do this at any time, before or after skinning your PDF. Page hits get logged into text files located in the same directory as the skinned PDF, so the web server must have write access to that directory.

If a page is named pg_0025.pdf , its hit log is named pg_0025.pdf.hits . Each hit adds one line to the file. Each line includes the IP number that requested the page, so you can identify unique visitors if you desire .

After skinning your PDF and making sure hit logging works, visit http://www.pdfhacks.com/skins/ and download hit_report.php-1.0.zip . Unpack this single PHP file and copy it onto your web server.

If your skinned PDF is located in the directory:

 http://pdfhacks.com/eno/skinned_php/ 

pass its location to hit_report like so:

 http://pdfhacks.com/hit_report.php?pdf=/eno/skinned_php 

The document outline should appear in your browser, just as it does on the skinned PDF's title page. On the right side of the page, a column of numbers shows the number of hits on each outline topic.

For sections that span multiple pages, page hits are summed to create the section-hit count. However, section-hit counts do not include subsection-hit counts. If multiple sections have headings that appear on the same document page, those sections will also share the same hit count. hit_report identifies these by giving these sections the same background color . For example, the report in Figure 5-19 shows that the section headings "CHAPTER SIX: THE COMPOSITIONAL PROCESS" and "Equipment" are both on the same page.

5.24.1 Hacking the Hack

Provide this hit information to your readers by merging hit_report features with the current skin templates index.html and index.toc.html .

 < Day Day Up > 


PDF Hacks.
PDF Hacks: 100 Industrial-Strength Tips & Tools
ISBN: 0596006551
EAN: 2147483647
Year: N/A
Pages: 158
Authors: Sid Steward

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net