<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>phantomjs Archives - Alexandros Georgiou</title>
	<atom:link href="https://www.alexgeorgiou.gr/tag/phantomjs/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.alexgeorgiou.gr/tag/phantomjs/</link>
	<description>Balancing brackets for a living</description>
	<lastBuildDate>Wed, 20 Dec 2023 10:29:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://www.alexgeorgiou.gr/wp-content/uploads/2021/07/cropped-alexgeorgiou-icon-32x32.png</url>
	<title>phantomjs Archives - Alexandros Georgiou</title>
	<link>https://www.alexgeorgiou.gr/tag/phantomjs/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>👻 Monitor analytics of a public WordPress plugin using PhantomJS</title>
		<link>https://www.alexgeorgiou.gr/scrape-daily-analytics-wordpress-plugin/</link>
					<comments>https://www.alexgeorgiou.gr/scrape-daily-analytics-wordpress-plugin/#respond</comments>
		
		<dc:creator><![CDATA[alexg]]></dc:creator>
		<pubDate>Sat, 09 Jun 2018 10:14:06 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[installations]]></category>
		<category><![CDATA[issues]]></category>
		<category><![CDATA[metric]]></category>
		<category><![CDATA[phantomjs]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[scraper]]></category>
		<category><![CDATA[statistics]]></category>
		<category><![CDATA[usage]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://www.alexgeorgiou.gr/?p=262</guid>

					<description><![CDATA[<p>A script to scrape and save daily usage statistics for a WordPress plugin for later use in analytics.</p>
<p>The post <a href="https://www.alexgeorgiou.gr/scrape-daily-analytics-wordpress-plugin/">👻 Monitor analytics of a public WordPress plugin using PhantomJS</a> appeared first on <a href="https://www.alexgeorgiou.gr">Alexandros Georgiou</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>When a WordPress plugin is hosted on WordPress.org, some basic usage statistics are shown on its page. These can be used in your plugin analytics.</p>
<h2>The problem</h2>
<p>I needed an easy way to gather up some of these daily stats into a <code>.csv</code> file for later analysis and monitoring.</p>
<p>Data I was interested in:</p>
<ul>
<li>The approximate current number of installs (this number is rounded)</li>
<li>The number of yesterday&#8217;s new downloads (today&#8217;s downloads depends on what time you run the script)</li>
<li>The number of total downloads</li>
<li>The number of support issues reported within the last month</li>
<li>The number of support issues resolved within the last month</li>
</ul>
<p>Most of these numbers are found in the static HTML, but the download counts are added in later via JavaScript. Hence the need for phantomjs.</p>
<h2>The solution</h2>
<p>A good place to go to gather these statistics is the <em>advanced</em> view of WordPress.org. For example, to see some basic statistics for my plugin, <a href="http://dashed-slug.net/bitcoin-altcoin-wallets-wordpress-plugin/" target="_blank" rel="noopener">Bitcoin and Altcoin Wallets</a>, you could visit:</p>
<pre><a href="https://wordpress.org/plugins/wallets/advanced/" target="_blank" rel="noopener">https://wordpress.org/plugins/wallets/advanced/</a></pre>
<p>Scraping a static HTML page is easy. For example, it could have been done in PHP using <a href="https://code.google.com/archive/p/phpquery/" target="_blank" rel="noopener">phpQuery</a>. But I decided to use this opportunity as a gentle introduction into learning <a href="http://phantomjs.org/" target="_blank" rel="noopener">PhantomJS</a>. PhantomJS is very useful for black box testing, but it is also suitable for scraping data. Additionally, I would like to scrape the download counts that are not available as part of the static HTML.</p>
<p>The script is now posted on <a href="https://github.com/alex-georgiou/wordpress-plugin-stats-scraper" target="_blank" rel="noopener">github</a>. See the <code>README.md</code> file for usage instructions.</p>
<p style="text-align: center;"><a href="https://github.com/alex-georgiou/wordpress-plugin-stats-scraper" target="_blank" rel="noopener">https://github.com/alex-georgiou/wordpress-plugin-stats-scraper</a></p>
<h2>Running it daily</h2>
<p>The plugin is suitable for running via cron. You should run it once a day.</p>
<p>Keep in mind that tasks running with cron may not have the working directory you expect. And the path variable might be empty. So make sure to specify full paths. Here&#8217;s how it looks like in my crontab:</p>
<pre>0 1 * * * QT_QPA_PLATFORM=offscreen /usr/bin/phantomjs /home/alexg/wordpress-plugin-stats-scraper/wordpress-plugin-stats-scraper.js wallets /home/alexg/wallets-stats.csv</pre>
<p>&nbsp;</p>
<p>The post <a href="https://www.alexgeorgiou.gr/scrape-daily-analytics-wordpress-plugin/">👻 Monitor analytics of a public WordPress plugin using PhantomJS</a> appeared first on <a href="https://www.alexgeorgiou.gr">Alexandros Georgiou</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.alexgeorgiou.gr/scrape-daily-analytics-wordpress-plugin/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
