Campaign attribution enrichment + my own parameters

Hey,

I’ve setup snowplow through the quick start guide on AWS. Everything is working fine so far (using the javascript tracker).

My challenge is to track multiple parameters. Example: I want to track the parameter “fb_campaign” in “utm_campaign” & “fb_ad” in “utm_content”.

Here in the docs it says this is possible through some sort of configuration.

I’m unsure where to add this configuration though?

My best guess would be that I have to deploy a whole new aws-enrich-kinesis-ec2 instance with this new schema/configuration?

This would seem awfully complex though, since I had to modify and start and connect this new instance each time I have a new parameter that I didn’t know of before?!

Also how would I connect a new enrich instance back into my already existing pipeline that I setup through the quick start terraform template?

Any hints are greatly appreciated.
Thanks
Moritz

Hi @Moritz_Bauer,

On this page we link to instructions for AWS/GCP/Azure on how to add or remove enrichments. The steps for configuring one are similar. You would add your enrichment configuration to your Terraform file and run terraform apply.

2 Likes

@stanch Thanks for pointing me in the right direction!

For anyone who might see this in the future and doesn’t know much about Terraforms (like I do), what you have to do is this:

  1. Put this code into your Terraform main.tf file:
locals {
  enrichment_campaign_attribution = jsonencode(<<EOF
{
  "schema": "iglu:com.snowplowanalytics.snowplow/campaign_attribution/jsonschema/1-0-1",
  "data": {
    "name": "campaign_attribution",
    "vendor": "com.snowplowanalytics.snowplow",
    "enabled": true,
    "parameters": {
      "mapping": "static",
      "fields": {
        "mktMedium": ["utm_medium", "medium"],
        "mktSource": ["utm_source", "source"],
        "mktTerm": ["utm_term", "legacy_term"],
        "mktContent": ["utm_content", "**fb_campaign**"],
        "mktCampaign": ["utm_campaign", "cid", "legacy_campaign", "**fb_ad**"],
        "mktClickId": {
                      "gclid": "Google",
                      "fbclid": "Facebook"
        }
      }
    }
  }
}
EOF
  )
}

The mktClickId is there because I wanted to capture the clickid as well. See this section Campaign attribution enrichment | Snowplow Documentation for more Info.

  1. Add this code at the end of your module "enrich_kinesis" {... section
  # Enable this enrichment
  enrichment_campaign_attribution = local.enrichment_campaign_attribution
  1. Hit terraform apply

Terraform will then deploy the changes! (Didn’t look like it started a new server or had to reboot the old one. Also all endpoint URLs stayed the same, so worked pretty perfectly :slight_smile: )

2 Likes