I am trying to figure out how revenue is being allocation to a source/medium (GOOGLE ANALYTICS 360)
So I asked reddit and got the following answer:
"Depends, if you are looking at sessions or first visit attribution. Sessions level will be the users source of the users first pageview event of a session. (I am not really sure what this means).
First visit would be the source of the users first visit to your site. Sources can change during a sessions but I believe only the first source of a session is used."
So I am trying to do this in bigquery now.
SELECT *,gadate, customer_id
FROM
(SELECT
trafficsource.source as source
, COUNT(DISTINCT CONCAT(fullVisitorId, CAST(visitStartTime AS STRING))) AS sessions
, (SELECT MAX(IF(index=5, value, NULL)) FROM UNNEST(t.customDimensions)) AS customer_id
, PARSE_DATE('%Y%m%d',date) as gadate
FROM
`project.dataset.ga_sessions_*` t, Unnest(hits) hits
GROUP BY trafficsource.source, date, customer_id
)
WHERE customer_id = '123xyz' AND gadate BETWEEN '2023-05-01' AND '2023-05-31'
When I run this statement, I see that on May-27th $250 was allocated to Facebook.
Do this mean that since the user used Facebook as their last platform before they made the sale....so that's why revenue was allocated to Facebook?
How can I understand through BigQuery...why was $250 allocated to Facebook?
Can someone share a code with me to help me understand this revenue allocation.