Here’s Task 7 from the Marketing Attribution Project
To figure out which 5 campaigns brought in the most purchasers, I thought it would be good to set up a funnel of some sort.
From the given tasks I was able to figure out
A) How many last touches on the purchase page each campaign was responsible for,
B) How many first touches on the landing page each campaign was responsible for.
For (B), I thought it would be good to know how many of those first touches corresponded to a user who eventually visited the purchase page '4 - purchase," i.e., how many of those first touches translated into purchases. Here’s what I wrote (trying) to set up that funnel, which besides feeling monstrously over-complicated, only returned zero values for the ratio I tried to compute:
Here’s the result I got from running this:
I’m noticing three big problems here:
(1) The code is overcomplicated
(2) ‘counted’ is returning all page_visits, not first touches
(3) the ratio returns as zero, I’m assuming because of division of or by zero.
Any help would be awesome!