# Using correlations to re-label data from Google Analytics

In my Google Analytics data a lot of traffic gets mis-labelled as "Direct" because Google doesn't know the original traffic source.

I've taken 6 months worth of our "Direct" traffic data and calculated the correlation of that to other traffic channels, such as Organic and Social. There is a moderate correlation between Social and Direct.

My question is... is there a way to adjust the traffic numbers for "Social" (in a spreadsheet) to include some of the traffic from "Direct", knowing that there's a correlation between them?

Eg, say GA currently reports 1,000 social visits and 5,000 direct, can I attribute some of the direct to social, like: Social might now be 2,000.

Although I know the levels of correlation, there's no way of telling how much Direct is actually direct of course, so I don't know if this calculation is possible, or if there is a scientific way of going about the process.

I accept this wont be truly accurate or definitive, I'm looking at this as more of an indicator.

Thanks!

The total amount of Traffic is a deterministic function of Social, Direct, Referral, and Z (just pretend Z is all other sources combined - you can split them out separately yourself if you want).

$$\text{Traffic} = \text{Social} + \text{Direct} + \text{Referral} + \text{Direct}$$

Now what I believe would be useful to your situation is an estimate of the indirect effect of the amount of Social traffic on the other sources. I'm pretty ignorant of SEO, but I imagine getting mentioned alot on popular social network sites boosts your page rank, and so indirectly increases traffic from either higher search results (or other unknown sources). We can illustrate this is a path model as below:

Because Traffic is deterministic I simply placed 1's on those paths. The indirect effect then of social on the total amount of traffic through direct is the first path multiplied by the second path (in linear models), which is simply $1 \cdot d = d$. To fill in the blanks for $d$, $r$, and $z$ you need the covariances between Social and the indirect paths.

There are actually more informative ways to draw the diagram though, but it all stems from estimating these variances and covariances. It is typical to estimate the correlations and then fill in the paths based on the correlations and partial correlations. Another informative way though may be after you estimate the partial correlations is to rescale the diagram so that all arrows going into Traffic sum to 100. Then the direct effects on Traffic can be interpreted as percentage totals, and the indirect effects can be interpreted as the decomposition of the indirect effect of social. (This interpretation gets a bit strange though if you have negative correlations.)

This is of course a simplification. It is likely that the arrows between social and the indirect effects are not single headed, there could certainly be reciprocal effects. But I'm hoping this is a useful abstraction.

• Hi, thanks for your reply, i think this is trying to show how much Social influences other channels, which isn't quite what i'm after - but maybe I've misunderstood. "Direct" is a wrong label, it should be called "unknown" and i'd like to redistribute "unknown" & it's portion of traffic to other sources based on the correlation, so if social has a 0.6 correlation with it, it's possible that the "unknown (direct)" is actually partially mislabelled social traffic, and partially mislabelled other traffic, can I use the second part of your answer "everything adds up to 100" to redistribute it? – Ross Scrivener Aug 26 '14 at 15:33
• You can reorient this same path analysis approach to accomplish that @RossScrivener. You would change all of the other paths going into Direct (so here both Z and Referral would have arrows going into Direct) and then yes normalize the arrows both going into Traffic to sum to 100 and arrows going into Direct to sum to 100, then you can interpret the indirect effects as a proportion of a proportion. The paths going from Social, Z & referral to direct would not be correlations though at that point, but partial correlations. – Andy W Aug 26 '14 at 18:44