<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Paul Newnes on Medium]]></title>
        <description><![CDATA[Stories by Paul Newnes on Medium]]></description>
        <link>https://medium.com/@paulnewnes?source=rss-67bfed410b06------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*einfLTN8qzNdVxTJ.</url>
            <title>Stories by Paul Newnes on Medium</title>
            <link>https://medium.com/@paulnewnes?source=rss-67bfed410b06------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 18:07:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@paulnewnes/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Easy e-commerce Markov Attribution with R]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">I published an R package to simplify running attribution analyses on website clickstream data. The details are as follows:</p><p class="medium-feed-link"><a href="https://medium.com/@paulnewnes/easy-e-commerce-markov-attribution-with-r-3d5290071882?source=rss-67bfed410b06------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@paulnewnes/easy-e-commerce-markov-attribution-with-r-3d5290071882?source=rss-67bfed410b06------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d5290071882</guid>
            <category><![CDATA[markov-chains]]></category>
            <category><![CDATA[attribution-modeling]]></category>
            <category><![CDATA[google-analytics]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[attribution-model]]></category>
            <dc:creator><![CDATA[Paul Newnes]]></dc:creator>
            <pubDate>Sat, 20 Jul 2019 10:54:20 GMT</pubDate>
            <atom:updated>2019-07-20T10:54:20.661Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Cloud Based Services Sentiment Analysis Head to Head – Part 2]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@paulnewnes/cloud-based-services-sentiment-analysis-head-to-head-part-2-661e1539c1f8?source=rss-67bfed410b06------2"><img src="https://cdn-images-1.medium.com/max/832/1*fLTFBD1hTmxeIPiTTMeClQ.png" width="832"></a></p><p class="medium-feed-snippet">We wrote a recent article and an accompanying how-to comparing the accuracy of 3 of the big cloud sentiment analysis services and a quick&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@paulnewnes/cloud-based-services-sentiment-analysis-head-to-head-part-2-661e1539c1f8?source=rss-67bfed410b06------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@paulnewnes/cloud-based-services-sentiment-analysis-head-to-head-part-2-661e1539c1f8?source=rss-67bfed410b06------2</link>
            <guid isPermaLink="false">https://medium.com/p/661e1539c1f8</guid>
            <category><![CDATA[text-analytics]]></category>
            <category><![CDATA[sentiment-analysis]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[azure-services]]></category>
            <category><![CDATA[r]]></category>
            <dc:creator><![CDATA[Paul Newnes]]></dc:creator>
            <pubDate>Sat, 14 Jul 2018 20:52:12 GMT</pubDate>
            <atom:updated>2018-07-14T20:52:12.991Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Head to Head Test of Sentiment Analysis Cloud Services]]></title>
            <link>https://medium.com/@paulnewnes/head-to-head-test-of-sentiment-analysis-cloud-services-b6d4a2d70e50?source=rss-67bfed410b06------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6d4a2d70e50</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[ibm-watson-conversation]]></category>
            <category><![CDATA[sentiment-analysis]]></category>
            <dc:creator><![CDATA[Paul Newnes]]></dc:creator>
            <pubDate>Wed, 20 Jun 2018 19:27:01 GMT</pubDate>
            <atom:updated>2018-06-20T19:27:01.056Z</atom:updated>
            <content:encoded><![CDATA[<p>I went to an event a little over a year ago at Manchester University where the topic was around Artifical Intelligence in Marketing. Rather than the vapid ‘AI will change everything’ claptrap one sees on LinkedIn, the presentation and subsequent Q&amp;A were focussed on the paths to how we will actually get to new endpoints of automation using AI and machine learning.</p><p>A rather interesting point of conversation was around natural language processing and sentiment analysis. My previous experience with such services, albeit over 5 years previously, had been exceedingly disappointing. Evidently much has changed; NLP and sentiment analysis are the key ingredients to a new wave of interactive agents (bots) that will at first complement and then potentially replace human-populated services such as contact centers. Evidently the tech is a way off replacing anyone yet but the increase in sophistication is not a linear function; rather the development is accelerating.</p><p>As scary as this sounded it picqued my curiosity. Given these innovations and that several different cloud based services have launched from familar names, we wondered if there was a (relatively) quick way to use these services in a commercial application.</p><p>We’ve written a <a href="https://www.deducive.com/blog/2018/6/02/using-r-for-sentiment-analysis-with-aws-comprehend-google-cloud-natural-language-ibm-watson">full guide of how the Amazon, Google and IBM sentiment analysis services stack up against each other</a>, but the hypothesis was fairly simple: can they be used in combination to gain better results?</p><p>The answer is that mostly they can. Our sample had 498 tweets all of which had been pre-categorized as positive, negative or neutral in sentiment. The highest category of the three was positive with 182 tweets giving a baseline no-information-rate (NIR) of 37%. The NIR is the number to beat to assess if any value is provided by these services.</p><p>We tested each service independently and then if two of the services agreed, we’d go with the majority vote. Fortunately so few of the tweets were categorized as neutral we didn’t have to clean up any 3-way ties.</p><p>For this data set (results can vary wildly for different types of data) each service performed reasonably well, but as can be seen from the chart below 5% overall accuracy was added by combining the services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*C96GT4m3Aur1dcUZ8qWr0w.png" /></figure><p>Whether 73% is accurate enough for a given commercial application is a separate conversation. But, these services are only going to get better and the pricing is pretty low. Therefore using in combination may be a better strategy than trying to customize or train the services independently.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6d4a2d70e50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to (easily) get ad insights out of Facebook and into R.]]></title>
            <link>https://medium.com/@paulnewnes/how-to-easily-get-ad-insights-out-of-facebook-and-into-r-916a0b18f21b?source=rss-67bfed410b06------2</link>
            <guid isPermaLink="false">https://medium.com/p/916a0b18f21b</guid>
            <category><![CDATA[facebook-api]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[r-package]]></category>
            <category><![CDATA[r-programming]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Paul Newnes]]></dc:creator>
            <pubDate>Sun, 28 Jan 2018 17:28:56 GMT</pubDate>
            <atom:updated>2018-01-28T17:32:52.236Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pem1dvcFOoeo9b0ijSMP7g.jpeg" /></figure><p>The Facebook ad insights API is pretty extensive and relatively simple to use. We use R for our analysis and ad automation, and the <a href="https://cran.r-project.org/web/packages/httr/index.html">httr package</a> to effectively translate R into cURL necessary to access the Facebook API.</p><p>The httr R code can get a bit unwieldy so we created an R package, <a href="https://github.com/Deducive/FBinsightsR">FBinsightsR</a> to make it easier to pull summary ad performance and ad performance at the most granular level including age and gender. The latter will generate over 10x rows per ad per day and can make the API time out. Hence the need for a simple function that can run on set intervals through a time range.</p><p>There are other R packages that do similar things, but we’ve tried to keep this super simple with just two functions:</p><pre>fbins_summ</pre><pre>fbins_ag</pre><p>… the former pulling summary data and the latter pulling all data. The functions return the data in a nice data frame so there’s no messing around with JSON.</p><p>For anyone still exporting spreadsheets out of Facebook Ad Manager, I’d suggest learning a little R and using the API to automate rather than the tedium (and error proneness) of exporting and renaming spreadsheets.</p><p>We hope the package is of use.</p><p><a href="https://www.deducive.com/blog/2018/1/24/fbinsightsr-get-facebook-marketing-insights-into-r-easily">Full details of how FBinsightsR works available on deducive.com .</a><br><a href="https://github.com/Deducive/FBinsightsR">FBinsightsR package on GitHub.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=916a0b18f21b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Automate Facebook Canvas Creation with R & R Studio]]></title>
            <link>https://medium.com/@paulnewnes/how-to-automate-facebook-canvas-creation-with-r-r-studio-724f7d6b5c7?source=rss-67bfed410b06------2</link>
            <guid isPermaLink="false">https://medium.com/p/724f7d6b5c7</guid>
            <category><![CDATA[rstudio]]></category>
            <category><![CDATA[advertising]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[facebook-marketing]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Paul Newnes]]></dc:creator>
            <pubDate>Tue, 19 Dec 2017 15:19:01 GMT</pubDate>
            <atom:updated>2017-12-19T15:38:44.417Z</atom:updated>
            <content:encoded><![CDATA[<h3>Facebook’s shiny new toy</h3><p>If you haven’t heard, Facebook’s new Canvas ads for mobile are blowing up. They’re full screen, immersive, and generally a lot more fun than the typical Facebook video or carousel ad. And they address the number one problem for mobile — page load time — by having all the underlying image, text and video content hosted on Facebook’s platform. They load in the blink of an eye rather than the 4–10 seconds for the average non-Facebook hosted mobile web page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*835Kz6xaNJbIu8YoL4o7gw.gif" /><figcaption>Sample Canvas Ad: Carnival Cruise Line (<a href="https://youtu.be/sXsl55iiDC0">click for video</a>)</figcaption></figure><p>But creating more than one of them is a big pain. There is no Facebook Power Editor for Canvas ad creation, but Facebook does allow for automated <a href="https://marketingland.com/facebooks-canvas-ads-become-easier-create-recreate-new-api-211092">Canvas creation via API</a>. This means it is possible to create customized Canvases at scale, but it isn’t easy.</p><p>We decided to change that. And we wanted to do it using open source software we already used for marketing analytics. So we created an application in R Studio — the integrated development environment for the programming language R.</p><p>R isn’t just a tool for statistical analysis any more. It’s also a powerful platform for creating programmatic advertising campaigns. The development of packages such as ‘<a href="https://cran.r-project.org/web/packages/httr/vignettes/quickstart.html">httr</a>’, originally for web-scraping, has a nice secondary use of being able to interact with APIs such as Facebook’s. Since httr translates R into cURL you can create, edit, and analyze advertising campaigns on a single platform.</p><h3>Why we took on the Canvas challenge</h3><p>We wished to target a US client’s ads down to the ZIP code level and only to smartphone devices. Our objective was to get the client’s brand names and products into consumers’ minds close to the physical point of purchase. And we only wanted to promote specific products at locations that we knew to carry them.</p><p>Given load time is the number one reason for mobile site abandonment, we wanted to use Facebook Canvases instead of standard microsite landing pages.</p><p>While fast-loading and highly engaging, Canvases are not flexible — they cannot be edited after they are published. This means they cannot contain dynamic elements that change based on URL parameters like a typical landing page. Therefore, we’d need to create one Canvas for every ad permutation. And we’d need the infrastructure in place to quickly update all of the Canvases automatically for content refreshes and design testing.</p><p>So we began the journey deep into Facebook’s marketing API.</p><h3>There be monsters in this documentation</h3><p>The documentation for Facebook’s API is extensive, but as one would expect, far from perfect. A big problem is the sometimes haphazard way documentation pages are presented in Google search results — older, deprecated documentation can appear ahead of newer more relevant pages. Unless someone, like us, has written an article for accomplishing a specific goal, then it’s a combination of critical analysis, and trial and error to get to the correct answer.</p><p>Further confusing matters, Facebook Apps for use as page tabs or games also use the name ‘canvas’, but are unrelated. Mobile Canvas ads are sometimes referred to as ‘Collection Ads’ and ‘Full Screen Experience’. Again this doesn’t make the task of locating the correct answers any easier.</p><h3>A quick guide to creating Canvases in R</h3><p>While some additional reading and research will still be necessary, below is a quick guide to getting started with programmatically creating canvases.</p><h4>THE KEY STEPS TO CREATING A FACEBOOK CANVAS TEMPLATE IN R</h4><ol><li>Design and publish a Canvas in the <a href="https://www.facebook.com/business/help/1194534547226732">Facebook Canvas Builder</a> to serve as a template and grab the Canvas ID from the canvas URL.</li><li>Create a Facebook App in Business Manager to generate the access tokens and privileges to associate the app with the brand page where the canvas assets will live.<br><em>It’s important to note that your Canvases are associated with brand pages rather than ad accounts, hence the need to pay attention to permissions and access tokens.</em><br><em>Your app does not need to be approved for public use to gain the specific privileges needed.</em></li><li>Grab all the elements and formatting for the Canvas through the API by using <a href="https://developers.facebook.com/tools/explorer/">Graph API Explorer</a> to generate the cURL code to be translated by httr.</li><li>Flatten out each element and formatting option in the returned JSON element into variables in a <a href="http://vita.had.co.nz/papers/tidy-data.pdf">tidy R dataframe</a>.</li><li>Place your image and video assets onto a cloud account such as S3, grab the deep links and add these as variables to the frame.</li></ol><p>You now have a template data frame. Each row represents an individual Canvas and each column represents a content or formatting parameter for the Canvas. You can then populate the dataframe in R with whichever data set you wish. Here comes the trickier part — grabbing all the element IDs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WKne25ohSf4bUa566Lwz5A.png" /><figcaption>Canvas element IDs in R Studio</figcaption></figure><p><a href="https://developers.facebook.com/ads/blog/post/2017/04/03/canvas-api/">This post </a>shows that from the base elements of photos and text there is a specific order in which you must post assets to get element IDs. Once you have the final element IDs, these are POST-ed in their vertical order and a Canvas ID is returned. You can easily construct the Canvas URL by adding the ID to:</p><p><strong>(https://)fb.com/canvas_doc/your_canvas_ID</strong></p><p>This is now the target / click-through URL for your ads whether you create them through the API or Power Editor/Ads Manager. The neat thing is when you add a Canvas URL into a create / edit ad screen in Facebook Ad Manager or Power Editor, the ad format automatically changes to one of the Canvas options.</p><p>And that’s it. Each Canvas takes about 30 to 45 seconds to create.</p><h3>What we’ve learned from this journey</h3><blockquote><strong><em>“A man who has been through bitter experiences and travelled far enjoys even his sufferings after a time.” — Homer, </em>The Odyssey</strong></blockquote><p>There doesn’t seem to be any upper limit of the number of Canvases that can be created nor the number of image assets that can be uploaded to a page for use within Canvases. That’s both a good and a bad thing — but, we’d prefer to know so we could plan against it. Since brand pages are free, hitting an upper limit would just mean using a new brand page to store assets and create Canvases.</p><p>Once you’ve created scores of Canvases, using the web-based Facebook tools for managing Canvases and creating Canvas-based custom audiences becomes difficult. It’s easy to get the feeling the management tools were an afterthought to the main Canvas product and certainly don’t accommodate managing an abundance of Canvases. Once you start to use the API to create Canvases and ads at scale, plan to use the API to manage at scale.</p><p>The performance measurement of Canvases is tied to the ads that link to them. Again, the easiest way to do this is through the Facebook API, specifically the <a href="https://developers.facebook.com/docs/marketing-api/insights">Insights API</a>. There are three relevant metrics:</p><ul><li>Clicks-through</li><li>Time spent within a Canvas</li><li>%age of Canvas viewed</li></ul><p>A query to the Insights API at the ‘ad’ level will return a lot of data. This is where R is your friend — filtering and summarizing tens of thousands of rows of data takes less than a second.</p><p>In conclusion, this final point emphasizes why R, once the purview of academia, is becoming a powerful multi-purpose programming language. Within a single script one can create Facebook Canvases, ads, targeting criteria, and analyze the campaign performance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=724f7d6b5c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>