0
0
Digital Marketingknowledge~5 mins

Multi-channel attribution in Digital Marketing - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: Multi-channel attribution
O(n)
Understanding Time Complexity

When analyzing multi-channel attribution, we want to understand how the effort to assign credit to marketing channels grows as the number of channels and interactions increase.

We ask: How does the work needed change when more channels or customer touchpoints are involved?

Scenario Under Consideration

Analyze the time complexity of the following simplified attribution calculation.


// For each customer journey
for journey in journeys:
  # For each touchpoint in the journey
  for touchpoint in journey.touchpoints:
    # Assign credit to the channel
    credit[touchpoint.channel] += calculate_credit(touchpoint)

This code assigns credit to each marketing channel by going through every touchpoint in every customer journey.

Identify Repeating Operations

Identify the loops, recursion, array traversals that repeat.

  • Primary operation: Looping through each customer journey and then each touchpoint inside it.
  • How many times: The inner loop runs once for every touchpoint in every journey, so total operations depend on total touchpoints across all journeys.
How Execution Grows With Input

As the number of journeys and touchpoints grows, the total work grows roughly in proportion to the total touchpoints.

Input Size (n = total touchpoints)Approx. Operations
10About 10 credit assignments
100About 100 credit assignments
1000About 1000 credit assignments

Pattern observation: The work grows directly with the number of touchpoints; doubling touchpoints doubles the work.

Final Time Complexity

Time Complexity: O(n)

This means the time to assign credit grows in a straight line with the total number of touchpoints processed.

Common Mistake

[X] Wrong: "Adding more channels won't affect processing time much because we only assign credit once per journey."

[OK] Correct: Each channel appears in touchpoints, so more channels usually mean more touchpoints to process, increasing total work.

Interview Connect

Understanding how the number of customer interactions affects processing time helps you explain how marketing data scales and why efficient attribution matters.

Self-Check

"What if we grouped touchpoints by channel first and then assigned credit? How would that change the time complexity?"