1. Home
  2. Docs
  3. Enriching your data
  4. Available enrichments
  5. Campaign attribution enrichment

Campaign attribution enrichment

This enrichment can be used to link events to marketing campaigns, using the query string parameters.

When using online marketing campaigns to drive traffic to our website, it is usually possible to find information in the query string parameters to identify the particular campaign, channel, medium and more.

A link for an online advertisement that brings users back to our site might look like:

Code language: JavaScript (javascript)

This could result in the following fields being added to the enrich event :


This enrichment automatically knows about Google (corresponding to the “gclid” query string parameter), Microsoft (“msclkid”), and DoubleClick (“dclid”). For example, if the query string contains &gclid=abc& then mkt_clickid field will be populated with "abc" and mkt_network field would be populated with "Google".


Example for standard Google parameters:

"parameters":{ "mapping":"static", "fields":{ "mktMedium":[ "utm_medium" ], "mktSource":[ "utm_source" ], "mktTerm":[ "utm_term" ], "mktContent":[ "utm_content" ], "mktCampaign":[ "utm_campaign" ] } }
Code language: JavaScript (javascript)

Example customizing mktClickId . This particular example:

  1. adds mappings of the wbraid and gbraid parameters to Google as the corresponding mkt_network and
  2. overrides the msclkid mapping (the other default mappings for gclid and dclid remain unaffected) :
"parameters":{ "mapping":"static", "fields":{ "mktMedium":[ "utm_medium" ], "mktSource":[ "utm_source" ], "mktTerm":[ "utm_term" ], "mktContent":[ "utm_content" ], "mktCampaign":[ "utm_campaign" ], "mktClickId": { "wbraid": "Google", "gbraid": "Google", "msclkid": "Override" } } }
Code language: JavaScript (javascript)

Example for Omniture (only mkt_campaign can be populated)

"parameters":{ "mapping":"static", "fields":{ "mktMedium":[ ], "mktSource":[ ], "mktTerm":[ ], "mktContent":[ ], "mktCampaign":[ "cid" ] } }
Code language: JavaScript (javascript)

It is possible to have more than one parameter name in each array. If multiple acceptable parameter names for the same field are found in the query string, the first one listed in the configuration JSON will take precedence. Example:

"parameters":{ "mapping":"static", "fields":{ "mktMedium":[ "utm_medium", "medium" ], "mktSource":[ "utm_source", "source" ], "mktTerm":[ "utm_term", "legacy_term" ], "mktContent":[ "utm_content" ], "mktCampaign":[ "utm_campaign", "cid", "legacy_campaign" ] } }
Code language: JavaScript (javascript)


This enrichment populates the following fields of the atomic event :

mkt_mediumThe advertising or marketing medium, for example: banneremail newsletter.
mkt_sourceIdentifies the advertiser, site, publication, etc. that is sending traffic to your property, for example: newsletter4billboard.
mkt_termIdentifies keywords (terms).
mkt_contentUsed to differentiate similar content, or links within the same ad. For example, if you have two call-to-action links within the same email message, you can use mkt_content and set different values for each so you can tell which version is more effective.
mkt_campaignThe individual campaign name, slogan, promo code, etc. for a product.
mkt_clickidClick ID which resulted in the redirect/follow request
mkt_networkThe advertising network name, either default determined from parameter for Click ID or custom specifically stated

If the enrichment is not activated, those fields will not be populated.

If you’d like to learn more about Snowplow BDP you can book a demo with our team, or if you’d prefer, you can try Snowplow technology for yourself quickly and easily.