<?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 Jeff Parks on Medium]]></title>
        <description><![CDATA[Stories by Jeff Parks on Medium]]></description>
        <link>https://medium.com/@jeffreyparks?source=rss-7247ba37cfdc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-ATDz5e-FxSFbBr9EeOyDg.jpeg</url>
            <title>Stories by Jeff Parks on Medium</title>
            <link>https://medium.com/@jeffreyparks?source=rss-7247ba37cfdc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 01:27:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jeffreyparks/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[Building More Realistic Media Effects Models]]></title>
            <link>https://jeffreyparks.medium.com/building-more-realistic-media-effect-models-5b52c38a4d0f?source=rss-7247ba37cfdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b52c38a4d0f</guid>
            <category><![CDATA[time-series-analysis]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[advertising-and-marketing]]></category>
            <category><![CDATA[advertising]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Jeff Parks]]></dc:creator>
            <pubDate>Sun, 21 May 2023 04:26:20 GMT</pubDate>
            <atom:updated>2023-05-21T04:32:57.863Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*bwOGbfccVZw6f3Wv7L7mMA.png" /><figcaption>a green wave of awareness?</figcaption></figure><h3>Adstock, How Does it Work?</h3><p>Rather than discuss a specific modeling technique or statistical concept, in this post, I’d like to talk about a concept specific to the media and advertising industry that I think is fairly important, but where I have not yet seen a reliable, consistent approach for measurement.</p><p>This concept is called <strong>Adstock</strong>. It’s not a great name, true. However, the concept is fairly simple. Advertisers devote considerable time, creative energy, and resources to making their messages resonate with media consumers. If we’re doing our job correctly, the consumer should remember that message long after they’ve been exposed to it.</p><p>Further, if the consumer has been exposed multiple times to that message during a given period, there should be some sort of cumulative, lasting effect on the mind and behavior of consumers, that does not simply disappear the moment we stop serving the message.</p><p>So, Adstock is the theoretical measure of the cumulative effect of all this advertising, at any given moment. And we would expect it to <em>gradually</em> diminish over time, and thus we should be able to model it according to some mathematical formula.</p><h3>Where is this so-called Adstock?</h3><p>Now that I’ve explained the concept, I think you’d agree it’s pretty important to have some kind of understanding of how much Adstock is out there right now for your ad campaigns, and how much time is left before consumers forget your message entirely.</p><p>And yet in my experience at several agencies, little to no attention is paid to this important concept at the media measurement and reporting level.</p><h3>You Can Measure Anything</h3><p>I suspect the main challenge to addressing the Adstock question is the difficulty of direct measurement. How do we efficiently measure the amount of advertising that people remember?</p><p>Brand Awareness survey data is probably a close proxy for Adstock effects, but (apart from being expensive) those are usually the response variables in our equation — the active question for advertisers is usually “How much do we need to spend to earn a marginal point in Brand Awareness (and stay ahead of our competitors’ scores)?”</p><p>If we’re using straight media impressions as a predictor in that particular model, with no adjustment for Adstock effects, we’re assuming our consumers are goldfish swimming around in a bowl, forgetting our message the moment their attention is drawn away. No offense, goldfish, but that doesn’t sound reasonable.</p><p>There is a wonderful book on business analytics and estimation, <a href="https://hubbardresearch.com/publications/how-to-measure-anything-book/"><strong>How to Measure Anything</strong></a> written by Douglas W. Hubbard. The title on the first page of the first section reads, “The Measurement Solution Exists” and it encapsulates the message that Hubbard drives home over and over again — no matter how tricky the problem, some kind of estimation is <strong>always</strong> possible, and it always improves your level of understanding and accuracy.</p><h3>Let’s Write Some Code</h3><p>For a recent project with a major social media brand, I was challenged to examine some weekly time-series data of Brand Awareness survey scores and to try and figure out the relationship of those scores to the amount of media impressions that were being served in the U.S. market at those times, among other variables.</p><p>This was a great opportunity to try and test my Adstock theories — would an adjustment to the raw media impressions help produce a better model? After a survey of the Internet to try and find examples of prior work or a package to help estimate media effects (and coming up short), I decided to write something simple, plug it in, and see what happened.</p><p>Please excuse some of the code… the numbers have been truncated &amp; altered from their original values, but they’re representative.</p><pre># get data: vector of numeric values representing media served in consecutive <br># periods... could be impressions, or views, or spend, etc.<br>media &lt;- read.csv(&#39;input/adstock_data.csv&#39;, header=F)$V1</pre><p>There are three manual variables we can adjust. The most significant is halflife_days, an estimate of days required for any media to lost 50% of its “effect” on consumers in the aggregate (set to 3 days here strictly as a guess.)</p><pre># manually set these three vars<br>halflife_days &lt;- 3 # estimated days for media to lose 50% effect<br>period_days &lt;- 1 # 7 == 1 week<br>periods_addl &lt;- 7 # additional periods to calculate after final media placement<br><br># more vars<br>periods &lt;- length(media)<br>periods_count &lt;- periods + periods_addl<br>df &lt;- data.frame(matrix(ncol=periods_count, nrow=0)</pre><p>And for the rate of decay of media effectiveness, we apply the exponential formula:</p><pre># for each element, create a vector and append values from exponential decay formula.<br>for(m in seq_along(media)){<br>  decay_vec&lt;- c(media[m])<br>  for(p in 1:(periods_count-m)){<br>    decay_vec &lt;- append(decay_vec, round(exp(log(0.5) * <br>                        p / halflife_days * period_days) * media[m]))<br>  }<br>  # pad each consecutive vector to the right by m-1 elements, append to df<br>  padded_vec &lt;- append(integer(m-1), decay_vec)<br>  df &lt;- rbind(df, padded_vec)<br>}</pre><pre># fix df column labels<br>colnames(df) &lt;- c(1:periods_count)<br><br># sum up<br>adstock &lt;- colSums(df)<br><br># pad the media vector and merge to final df<br>media &lt;- append(media, integer(length(adstock)-length(media)))<br>adstock_table &lt;- data.frame(media, adstock)</pre><pre># quick viz<br>period_labels &lt;- as.numeric(row.names(adstock_table))<br><br>ggplot(adstock_table) +<br>  geom_area(aes(x=period_labels, y=adstock), fill=&#39;green&#39;, alpha=.5, stat=&#39;identity&#39;) +<br>  geom_bar(aes(x=period_labels, y=media), fill=&#39;blue&#39;, stat=&#39;identity&#39;) +<br>  ggtitle(&#39;Media and Adstock Effect&#39;) + xlab(&#39;period&#39;) + ylab(&#39;effect&#39;) +<br>  scale_x_continuous(labels = period_labels, breaks=period_labels) +<br>  scale_y_continuous(labels = scales::label_number(suffix = &quot; K&quot;, scale = 1e-6))<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*GzV6di7hCYYSLJAtummSYQ.png" /></figure><p>In the plot above, the blue bars represent the actual media impressions served on a given day, and the green “wave” represents the cumulative Adstock effect.</p><h3>Moving Forward</h3><p>As we can see from the graph, the Adstock effect can be quite substantial, even with a moderate “half-life” of three days! It seems to me that there’s potentially some value in building Adstock-adjusted features for any number of standard models and reporting techniques.</p><p>The concept seems relevant to any important questions with a time-series aspect, such as:</p><ul><li>Is there a “saturation point” for our consumers where additional media has no marginal benefit? Can we calibrate ad frequency accordingly?</li><li>Are there different Adstock curves we should maintain based on product type or industry? (short or long customer journeys, price points, durable vs consumer goods, etc)</li><li>Are we modeling the relationships between Ad Spend and Brand Lift / Awareness properly over time?</li><li>Can we model the Adstock effects of successful, “sticky” campaigns vs. less successful campaigns?</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b52c38a4d0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intro to Timeseries Modeling with Prophet in R]]></title>
            <link>https://jeffreyparks.medium.com/intro-to-timeseries-modeling-with-prophet-in-r-abc96e0edd06?source=rss-7247ba37cfdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/abc96e0edd06</guid>
            <category><![CDATA[time-series-analysis]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[forecasting]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[timeseries]]></category>
            <dc:creator><![CDATA[Jeff Parks]]></dc:creator>
            <pubDate>Sun, 21 May 2023 00:58:44 GMT</pubDate>
            <atom:updated>2023-05-21T01:00:22.736Z</atom:updated>
            <content:encoded><![CDATA[<h3>Timeseries Forecasting</h3><p>The data science ecosystem abounds with solutions for timeseries forecasting, and depending on the need, these projects can become extremely complicated.</p><p>One point to consider is the trade-off between speed and accuracy for your analysis. If you’re forecasting potential flu transmission rates based on public health data, accuracy is probably going to be a lot more important than speed. If you’re in the business of buying advertising for carbonated soft drinks, however, then “fast and fairly accurate” is probably going to be more valuable than “slow and extremely precise.”</p><p>In my work with media agencies and brands, we are often asked to help forecast media budgets based on historical sales or survey data with seasonal patterns — and most of the time, it falls into the “fast and fairly accurate” category. In these cases, Prophet is a great starting point to work up forecasts quickly.</p><h3>Prophet</h3><p><a href="https://facebook.github.io/prophet/">Prophet</a> is a powerful, but easy-to-implement package for forecasting timeseries data. It is an open-source project created by the Facebook/Meta data science team, and runs on both R and Python. According to the documentation, Prophet works best on timeseries data with “strong seasonal effects and several seasons of historical data.”</p><p>As long as these conditions are met, Prophet is great at producing viable forecasts right out of the box, automatically detecting seasonality patterns within the data — however it is also flexible enough to be fine-tuned for specific purposes.</p><h3>Tasty Cola Sales Forecast</h3><p>To demonstrate how quickly one can work up a viable forecast, we’ll examine a timeseries dataset representing the monthly sales of a soft drink brand “Tasty Cola” in millions of units.</p><p>We’ll load in three years of historical sales data, and then ask Prophet to provide a sales forecast for Year 4.</p><pre># setup environment<br><br>#install.packages(&quot;devtools&quot;)<br>#devtools::install_github(&quot;FinYang/tsdl&quot;)<br>#install.packages(&quot;prophet&quot;)<br><br>library(tsdl)<br>library(prophet)<br>library(kableExtra)</pre><h3>1. Load and Transform Data</h3><p>The source of our data is the Timeseries Data Library Package (<a href="https://github.com/FinYang/tsdl">TSDL</a>), which includes nearly 650 sample timeseries datasets from a variety of industries and disciplines.</p><pre># Monthly Sales of Tasty Cola (Bowerman &amp; O&#39;Connell, 1993)<br>cola_monthly_sales &lt;- subset(tsdl,&quot;Sales&quot;)[6][[1]]</pre><p>The input to the Prophet model is very simple. It should be a dataframe with two columns: ds for the dates (which can be either a Date or a Timestamp object) and y containing the numeric value for each date’s observation.</p><p>In this case, however, TSDL produces a TimeSeries object with monthly text labels and numeric year labels:</p><pre>   Jan  Feb  Mar  Apr  May  Jun  Jul  Aug  Sep  Oct  Nov  Dec<br>1  189  229  249  289  260  431  660  777  915  613  485  277<br>2  244  296  319  370  313  556  831  960 1152  759  607  371<br>3  298  378  373  443  374  660 1004 1153 1388  904  715  441</pre><p>With a little transformation, we’ll turn this into a dataframe that Prophet can read:</p><pre># convert ts to df<br>start_date &lt;- as.Date(&quot;1990-01-01&quot;) <br>end_date &lt;- length(cola_monthly_sales)<br>dates &lt;- seq.Date(from = start_date, by = &quot;month&quot;, length.out = end_date)<br>df &lt;- data.frame(ds = dates, y = as.vector(cola_monthly_sales))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*aBa3tTaHlzvCZRkAhGwaZw.png" /><figcaption>df</figcaption></figure><h3>2. Fit the Model</h3><p>That was the hard part! Now all we have to do is fit the model, decide how far out we wish to forecast, and then make predictions.</p><p>We fit the model by passing our dataframe to the prophet() function.</p><pre>model &lt;- prophet(df)</pre><p><strong>Note:</strong> Prophet will detect the monthly seasonality from the dataset and disable daily/weekly.</p><h3>3. Make Predictions</h3><p>With our model trained on three years of historic data (1990, 1991, 1992), we’ll predict sales for the year 1993 — in this case, twelve monthly periods.</p><p>The function make_future_dataframe() creates a new dataframe to receive our predictions.</p><pre>df_1993 &lt;- make_future_dataframe(model, periods=12, freq=&#39;month&#39;)</pre><p>Next we make the predictions and append them to our dataframe with the predict() function.</p><pre>predict_1993 &lt;- predict(model, df_1993)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*kJeWojMSWFlB0Xn0T-QUzA.png" /><figcaption>predict_1993</figcaption></figure><p>Prophet’s built-in plot() function displays the results. This looks like a pretty viable forecast for a first run - we can clearly see a monthly seasonal trend with sales peaking in the summer months:</p><pre>plot(model, predict_1993)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*Yw_oNegr3-vY11cI59mMaw.png" /></figure><p>The prophet_plot_components function provides more granularity to this analysis. In this case we can see the underlying rising trend in sales (a mostly linear trend), but also the steep fluctuations in sales for individual months:</p><pre>prophet_plot_components(model, predict_1993)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*qt8wbgthXDlhIpt_0y4USg.png" /></figure><h3>Moving Ahead</h3><p>As you can see, Prophet is a pretty powerful tool when you need to get a quick read on well-defined seasonal data. If you haven’t worked with much timeseries data yet, the Prophet + TSDL combination is a great way to start exploring!</p><h3>More Reading</h3><ul><li><strong>Prophet</strong><br><a href="https://facebook.github.io/prophet/">https://facebook.github.io/prophet/</a></li><li><strong>Time Series Data Library (TSDL)</strong><br><a href="https://pkg.yangzhuoranyang.com/tsdl/articles/tsdl.html">https://pkg.yangzhuoranyang.com/tsdl/articles/tsdl.html</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abc96e0edd06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Tableau Prep for Mac]]></title>
            <link>https://jeffreyparks.medium.com/automating-tableau-prep-for-mac-a223fa3b1e34?source=rss-7247ba37cfdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a223fa3b1e34</guid>
            <category><![CDATA[tableau-prep]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[tableau-training]]></category>
            <category><![CDATA[tableau]]></category>
            <category><![CDATA[analytics]]></category>
            <dc:creator><![CDATA[Jeff Parks]]></dc:creator>
            <pubDate>Fri, 10 Jan 2020 14:35:24 GMT</pubDate>
            <atom:updated>2021-03-29T01:44:10.743Z</atom:updated>
            <content:encoded><![CDATA[<p>Tableau — Intermediate</p><p><strong>[Windows user? </strong><a href="https://medium.com/@jeffreyparks/automating-tableau-prep-for-windows-2caa2db7ed95"><strong>Click here for the Windows version of this article!</strong></a><strong>]</strong></p><p>If you’re working in the Tableau environment for your data analysis and visualizations, then <a href="https://www.tableau.com/products/prep/download"><strong>Tableau Prep</strong></a> is a lifesaver for building complex data transformations and performing that crucial ETL (Extract, Transform Load) function in your workflow.</p><p>Once you’ve created a Tableau Prep flow, your next instinct should be to automate it! If you happen to be fortunate enough to be working on <a href="https://help.tableau.com/current/prep/en-us/prep_conductor_config_server_overview.htm"><strong>Tableau Server</strong></a>, you know that you can upload Prep flows to your server instance, and schedule automated tasks with ease.</p><p>But what if you’re a startup or solo practitioner without the budget to afford the Tableau Server license and hardware? It’s just not practical or reliable to run your Prep flows manually every morning from your workstation.</p><p>Fortunately, certain Tableau Prep functions can be activated from the command line. With the help of a few configuration files, you can use the <strong>Mac Calendar </strong>to run your flows at regular intervals.</p><p>Let’s get started!</p><h3>What You’ll Need</h3><ol><li>A <strong>Tableau Prep</strong> flow file (.tfl)</li><li>Your system’s <strong>PATH</strong> environment variable.</li><li>A <strong>JSON file</strong> with credentials to your data sources and outputs.</li><li>A <strong>Shell Script</strong> authenticating Tableau Prep to use your credentials.</li><li>A <strong>Mac Calendar </strong>Event</li></ol><h3>1. A Tableau Prep Flow file (.tfl)</h3><p>Get the system path to your flow file and copy it down.</p><p><strong>Example:<br></strong>C:\Users\MyName\Documents\my_prep_flow.tfl</p><p><em>Note:</em> If the File or Directory names contain spaces, this may errors. You will need to remove spaces or replace with underscores.</p><h3>2. Your system’s PATH Variable</h3><p>This is important for reasons relating to Java containers and environment variables. From the console, type this and copy the result down for later.</p><pre>echo $PATH</pre><p><strong>Example:</strong></p><pre>/Users/MyName/.local/bin:/Users/Myname/.rbenv/shims:/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</pre><h3>2. A JSON File with your Credentials</h3><p>Copy and paste the template below into a text file, switch your credentials for the data source(s) and output destination(s) as applicable, then save it as <strong>connections.json</strong> in a safe location (I suggest creating a Scripts folder in your system’s Documents).</p><pre>{</pre><pre>&quot;inputConnections&quot;: [{</pre><pre>&quot;username&quot;:&quot;<strong>DATABASE USER</strong>&quot;,<br>&quot;password&quot;:&quot;<strong>DATABASE PASSWORD</strong>&quot;,<br>&quot;hostname&quot;:&quot;<strong>DATABASE HOST</strong>&quot;,<br>&quot;port&quot;: <strong>PORT</strong>,</pre><pre>}],</pre><pre>&quot;outputConnections&quot;: [{</pre><pre>&quot;username&quot;:&quot;<strong>DATABASE USER</strong>&quot;, <br>&quot;password&quot;:&quot;<strong>DATABASE PASSWORD</strong>&quot;,<br>&quot;serverUrl&quot;:&quot;<strong>DATABASE HOST</strong>&quot;,<br>&quot;contentUrl&quot;:&quot;&quot;,</pre><pre>}]</pre><pre>}</pre><p><strong>Example:</strong></p><pre>Saved to: C:\Users\<strong>MyName</strong>\Documents\Scripts\<strong>connections.json</strong></pre><p>Notes: a) In the <strong>Save As</strong> dialog, select All Files (*.*) under Save as type before saving. This will ensure that your connections.json file is saved with a JSON file extension. b) If the Directory your credentials file is stored in contains spaces, this will cause errors. You will need to remove spaces or replace with underscores.</p><h3>3. A Shell Script to Run Tableau Prep with your Credentials</h3><p>Copy and paste the below into a text file, switch the file locations, add your <strong>PATH</strong> variable, and save it somewhere safe (such as a Scripts folder in your system’s Documents) as the name of your prep flow with the extension <strong>.sh</strong></p><pre>#!/bin/bash</pre><pre>export PATH=&quot;<strong>PATH</strong>&quot;</pre><pre>/Applications/Tableau\ Prep\ Builder\ 2019.4.app/Contents/scripts/./tableau-prep-cli -c <strong>/path_to_my/connections.json</strong> -t <strong>/path_to_my/tableau-prep/Flows/my_prep_flow.tfl</strong></pre><p><strong>Example:</strong></p><pre>#!/bin/bash </pre><pre>export PATH=&quot;/Users/MyName/.local/bin:/Users/Myname/.rbenv/shims:/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin&quot;</pre><pre>/Applications/Tableau\ Prep\ Builder\ 2019.4.app/Contents/scripts/./tableau-prep-cli -c /Users/MyName/Documents/Scripts/connections.json -t /Users/MyName/Documents/tableau-prep/Flows/my_prep_flow.tfl</pre><p><strong>Example saved to:</strong></p><pre>/Users/MyName/Documents/Scripts/<strong>my_prep_flow.sh</strong></pre><p>Finally, make the script executable with the following command in the terminal:</p><pre>chmod u+x /Users/MyName/Documents/Scripts/<strong>my_prep_flow.sh</strong></pre><p><strong>Important Note:</strong> Tableau Prep versions have been updating fairly rapidly — as new versions are released, the version name of the app changes as well. Update this script accordingly to ensure your flows keep running on the latest version you have installed.</p><h3>4. A Mac Calendar Event</h3><ul><li>Open your Mac <strong>Calendar</strong> app</li><li>Create a new <strong>Event</strong> with the start and end time set to your preferred time and recurrence.</li><li><strong>Double-click</strong> the event to set a <strong>Custom Alert</strong> to <strong>Open File</strong> and select your Shell script location.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*foAR9Hq4NnDBbOwCF0RLtg.png" /></figure><p>Your Prep flow should now run on the dates and times you selected!</p><h3>Wrapping Up</h3><p>Advanced users might consider using <strong>cron</strong> from the command line instead of Calendar, but either approach will work.</p><p>There you have it — now get out there and automate all the things!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a223fa3b1e34" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Tableau Prep for Windows]]></title>
            <link>https://jeffreyparks.medium.com/automating-tableau-prep-for-windows-2caa2db7ed95?source=rss-7247ba37cfdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/2caa2db7ed95</guid>
            <category><![CDATA[tableau-training]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[tableau-prep]]></category>
            <category><![CDATA[tableau]]></category>
            <dc:creator><![CDATA[Jeff Parks]]></dc:creator>
            <pubDate>Fri, 10 Jan 2020 14:22:39 GMT</pubDate>
            <atom:updated>2020-01-10T14:37:06.642Z</atom:updated>
            <content:encoded><![CDATA[<p>Tableau — Intermediate</p><p><strong>[Apple user? </strong><a href="https://medium.com/@jeffreyparks/automating-tableau-prep-for-mac-a223fa3b1e34"><strong>Click here for the Mac version of this article!</strong></a><strong>]</strong></p><p>If you’re working in the Tableau environment for your data analysis and visualizations, then <a href="https://www.tableau.com/products/prep/download"><strong>Tableau Prep</strong></a> is a lifesaver for building complex data transformations and performing that crucial ETL (Extract, Transform Load) function in your workflow.</p><p>Once you’ve created a Tableau Prep flow, your next instinct should be to automate it! If you happen to be fortunate enough to be working on <a href="https://help.tableau.com/current/prep/en-us/prep_conductor_config_server_overview.htm"><strong>Tableau Server</strong></a>, you know that you can upload Prep flows to your server instance, and schedule automated tasks with ease.</p><p>But what if you’re a startup or solo practitioner without the budget to afford the Tableau Server license and hardware? It’s just not practical or reliable to run your Prep flows manually every morning from your workstation.</p><p>Fortunately, certain Tableau Prep functions can be activated from the command line. With the help of a few configuration files, you can use the <strong>Windows Task Scheduler</strong> to run your flows at regular intervals.</p><p>Let’s get started!</p><h3>What You’ll Need</h3><ol><li>A <strong>Tableau Prep</strong> flow file (.tfl)</li><li>A <strong>JSON file</strong> with credentials to your data sources and outputs.</li><li>A <strong>Shell Script</strong> authenticating Tableau Prep to use your credentials.</li><li>A <strong>Windows Task Scheduler</strong> Event</li></ol><h3>1. A Tableau Prep Flow file (.tfl)</h3><p>Get the system path to your flow file and copy it down.</p><p><strong>Example:<br></strong>C:\Users\MyName\Documents\my_prep_flow.tfl</p><p><em>Note:</em> If the File or Directory names contain spaces, this will cause errors. You will need to remove spaces or replace with underscores.</p><h3>2. A JSON File with your Credentials</h3><p>Copy and paste the template below into a text file, switch your credentials for the data source(s) and output destination(s) as applicable, then save it as <strong>connections.json</strong> in a safe location (I suggest creating a Scripts folder in your system’s Documents).</p><pre>{</pre><pre>&quot;inputConnections&quot;: [{</pre><pre>&quot;username&quot;:&quot;<strong>DATABASE USER</strong>&quot;,<br>&quot;password&quot;:&quot;<strong>DATABASE PASSWORD</strong>&quot;,<br>&quot;hostname&quot;:&quot;<strong>DATABASE HOST</strong>&quot;,<br>&quot;port&quot;: <strong>PORT</strong>,</pre><pre>}],</pre><pre>&quot;outputConnections&quot;: [{</pre><pre>&quot;username&quot;:&quot;<strong>DATABASE USER</strong>&quot;, <br>&quot;password&quot;:&quot;<strong>DATABASE PASSWORD</strong>&quot;,<br>&quot;serverUrl&quot;:&quot;<strong>DATABASE HOST</strong>&quot;,<br>&quot;contentUrl&quot;:&quot;&quot;, </pre><pre>}]</pre><pre>}</pre><p><strong>Example:</strong></p><pre>Saved to: C:\Users\<strong>MyName</strong>\Documents\Scripts\<strong>connections.json</strong></pre><p>Notes: a) In the <strong>Save As</strong> dialog, select All Files (*.*) under Save as type before saving. This will ensure that your connections.json file is saved with a JSON file extension. b) If the Directory your credentials file is stored in contains spaces, this will cause errors. You will need to remove spaces or replace with underscores.</p><h3>3. A Shell Script to Run Tableau Prep with your Credentials</h3><p>Copy and paste the template below into a text file, switch the file locations, and save it somewhere safe (such as a Scripts folder in your system’s Documents) as the name of your prep flow with the extension <strong>.bat</strong></p><pre>cd C:\Program Files\Tableau\<strong>Tableau Prep 2019.4</strong>\scripts</pre><pre>tableau-prep-cli.bat -c <strong>C:\my-path-to\connections.json</strong> -t <strong>C:\my-path-to</strong>\<strong>my_prep_flow.tfl</strong></pre><p><strong>Example:</strong></p><pre>cd C:\Program Files\Tableau\<strong>Tableau Prep 2019.4</strong>\scripts</pre><pre>tableau-prep-cli.bat -c <strong>C:\Users\MyName\Documents\connections.json</strong> -t <strong>C:\Users\MyName\Documents\my_prep_flow.tfl</strong></pre><pre>Saved to: C:\Users\MyName\Documents\Scripts\<strong>my_prep_flow.bat</strong></pre><p><strong>Important Note:</strong> Tableau Prep versions have been updating fairly rapidly — as new versions are released, the version name of the app changes as well. Update this script accordingly to ensure your flows keep running on the latest version you have installed.</p><h3>4. A Windows Task Scheduler Event</h3><p>On your Windows system, open:<br><strong><em>Task Scheduler &gt; Select Action &gt; Create Basic Task</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*AJnhY8RA5OXQlG7Uk_oRKw.png" /></figure><ul><li>Choose a name and a description for your task and click <strong>Next</strong>.</li><li>In the <strong>Trigger</strong> menu, select an option for the frequency you want your task to run, the start date, and the start time, and then click <strong>Next</strong>.</li><li>In the Action menu, select <strong>Start</strong> a program, click <strong>Next</strong>, click <strong>Browse</strong>, and select the <strong>.bat</strong> file you created in step 3. Click <strong>Next</strong> and then click <strong>Finish</strong>.</li></ul><p>Your Prep flow should now run on the dates and times you selected!</p><h3>Wrapping Up</h3><p>Advanced users might consider using <strong>cron</strong> from the command line instead of Task Scheduler, but either approach will work.</p><p>Special thanks to AJ Jones at Tinuiti for troubleshooting our Windows procedures.</p><p>There you have it — now get out there and automate all the things!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2caa2db7ed95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Quick Guide to URL Parameters]]></title>
            <link>https://jeffreyparks.medium.com/the-quick-guide-to-url-parameters-abfc385e9fd3?source=rss-7247ba37cfdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/abfc385e9fd3</guid>
            <category><![CDATA[marketing-analytics]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[google-analytics]]></category>
            <dc:creator><![CDATA[Jeff Parks]]></dc:creator>
            <pubDate>Wed, 08 Jan 2020 17:37:28 GMT</pubDate>
            <atom:updated>2020-01-13T00:40:17.014Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Marketing Analytics — Fundamentals</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TyilYfPtF_5YglS0" /><figcaption>Photo by <a href="https://unsplash.com/@timmossholder?utm_source=medium&amp;utm_medium=referral">Tim Mossholder</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><em>“The beginning of wisdom is to call things by their right names.” — Confucius</em></p><p>In the media world, URL Parameters often seem to fall into the category of <em>small, yet tremendously important things taken for granted.</em>¹ While tracking methods continue to evolve at a rapid pace, this vestigial tail of AdTech is still quite important and can get quite tricky at scale if you don’t plan wisely!</p><p>Let’s take a look..</p><h4>What are URL Parameters?</h4><p>Simply put, URL Parameters are labels attached to a destination URL that provide information to an analytics platform about the activity that generated traffic.</p><p>In other words, when a user clicks on your ad and arrives on a landing page, we can use URL parameters to tell the analytics platform which ad placement should receive credit for that visit.</p><p>For a basic example, consider a URL of:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*rJBluHbP3f181eH8G0ZyTw.png" /></figure><p>This URL includes three URL Parameters, informing your analytics platform that any visits from this URL originated from a Paid Search ad (“cpc”) on the Google Ads network. This example also includes some other useful information such as a Product ID (“pid”) associated with the ad creative.</p><h4>Need to Know</h4><p>There are three main things to remember about URL Parameters:</p><ul><li>Each URL Parameter consists of two parts; a <strong>key</strong> and a <strong>value</strong> separated by an equals sign (=).</li><li>The first Parameter always follows a question mark placed at the end of the base URL, and each subsequent Parameter is joined to the one before it with an ampersand (&amp;).</li><li>Parameter keys and values can be composed of any alphanumeric characters, and they should be <a href="https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding">url-encoded</a>.</li></ul><p>Remember, if URL parameters are missing or labeled incorrectly, your ads might not get credit for the traffic!</p><h4>Google and “UTM Parameters”</h4><p>Take special note of the final bullet above — <em>keys and values can be composed of any alphanumeric characters</em>. This means URL Parameters can be wonderfully flexible, but also incredibly frustrating to work with at scale, if you can’t get everyone to agree on a common format.</p><p>Google Analytics’ widely-adopted solution to this problem consists of five standard parameters, also known as the <strong>UTM Parameters¹ </strong>whose keys, appropriately, always start with the characters <strong>utm_</strong> …</p><ul><li><strong>utm_source</strong></li><li><strong>utm_medium</strong></li><li><strong>utm_campaign</strong></li><li><strong>utm_term</strong></li><li><strong>utm_content</strong></li></ul><p>Since Google Analytics is such a popular solution to track website traffic, the use of their <strong>UTM Parameters</strong> format is nearly universal, even if you’re not using Google Analytics as your analytics platform.</p><h4><strong>When to Use UTM Parameters</strong></h4><p>The correct answer in the Marketing Analytics space is <strong>“always.”</strong></p><p>It’s relatively easy if you’re using any of the Google Marketing Platform products to run your campaigns, such as <strong>Google Ads</strong>, <strong>Search Ads 360</strong> or <strong>Digital &amp; Video 360</strong>. Simply enable <a href="https://support.google.com/google-ads/answer/3095550?hl=en">auto-tagging</a> and Google does all the heavy lifting for you, populating the UTM Parameters with the correct values.</p><p>However, if you’re serving ads through non-Google platforms such as <a href="https://www.facebook.com/business/help/1016122818401732"><strong>Facebook</strong></a> or a DSP, all your destination URLs should have Google UTM parameters added manually. Check your platform’s documentation for specific instructions.</p><p>If you need to use the manual approach, Google has a free <a href="https://ga-dev-tools.appspot.com/campaign-url-builder/"><strong>campaign builder tool</strong></a> to quickly assemble URLs and parameters — give it a try.</p><h4><strong>How to Use UTM Parameters</strong></h4><p>Now for the fun part — getting agreement on a common format for URL Parameter <strong>values</strong> to use across all campaigns! This has been a major roadblock in every agency environment I’ve ever seen — a virtual hornet’s nest of naming conventions tempting all but the bravest analysts to set their hair on fire.</p><p>There’ll be a future post on handling UTM Parameters at scale, but for now, it might be helpful to at least establish some ground rules!</p><h4>utm_source</h4><p>This should always be the name of the ad platform, affiliate, email service or publisher. For example:</p><ul><li>Google Ads: <strong>google</strong></li><li>Facebook: <strong>facebook</strong></li><li>Twitter: <strong>twitter</strong></li><li>Mailchimp: <strong>mailchimp</strong></li></ul><p>utm_source <strong>should not be</strong>:</p><ul><li>The agency, account or client name</li><li>The bid management tool used to place the ad.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9K1Gxk0-GHSlxZxnzduwjA.png" /></figure><h4>utm_medium</h4><p>This should always refer to the high-level grouping of media types. The following values are highly suggested:</p><ul><li>Display: <strong>display</strong></li><li>Paid Search: <strong>paid_search </strong>or<strong> cpc</strong></li><li>Paid Social:<strong> paid_social</strong></li><li>Organic Social: <strong>organic_social</strong></li><li>Shopping: <strong>shopping</strong> or <strong>pla</strong></li><li>Affiliate: <strong>affiliate</strong></li><li>Email: <strong>email</strong></li></ul><p>utm_medium <strong>should not be</strong>:</p><ul><li>The agency, account or client name</li><li>The bid management tool used to place the ad.</li><li>The ad network / platform serving the ad</li><li>The tactic used for the ad (brand, programmatic, influencer, etc.)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*II9zuTcC-YUorVwa8W1Vvg.png" /></figure><h4>utm_campaign</h4><p>This should be identical to the campaign name in the ads platform, and can include additional descriptors such as tactic (brand, programmatic, influencer, etc.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xaTT5wBNud9oQ_z_lpQIAw.png" /></figure><h4><strong>utm_term</strong></h4><p>Used primarily for paid search, this tracks the keyword used for the ad. Auto-tagging generally covers this for you on Google.</p><p>For Facebook, this can be used for the <strong>ad set name </strong>(if you need to track it in your analytics platform.) For Twitter or LinkedIn, this can be used for a string of <strong>targeting parameters</strong> for the ad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MlDrmC8bwDImmmL7p0fhbQ.png" /></figure><h4>utm_content</h4><p>Used to identify the individual ad format or creative (i.e. carousel, banner)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cREtZykNPpk-TI7Q6dI3oA.png" /></figure><p>There you have it! Again, watch this space for a future post and tools for handling UTM Parameters at scale. If you found this Quick Guide helpful, please give it a clap, and comment below!</p><h4><strong>Footnotes</strong></h4><p>[1] Surely, there is a clever German expression for this.</p><p>[2]<strong> </strong>Way back at the dawn of the digital marketing age, Google acquired a small tech company called <a href="https://en.wikipedia.org/wiki/Urchin_(software)">Urchin Software Corporation</a> that specialized in website traffic analysis. The resulting product from that acquisition was Google Analytics, and one of its components was known as the Urchin Tracking Module, or <strong>UTM</strong>. Urchin <em>the company</em> is no longer with us, but their name lives on as Google Analytics’ UTM Parameters.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abfc385e9fd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>