Expand my Community achievements bar.

Join us for the next Community Q&A Coffee Break on Tuesday April 23, 2024 with Eric Matisoff, Principal Evangelist, Analytics & Data Science, who will join us to discuss all the big news and announcements from Summit 2024!
SOLVED

Missing query string params and Classification rule builder

Avatar

Level 1

We utilize the 5 Google UTM query parameters (source, medium, term, campaign, content) to track our campaigns (email, search, etc.). In order to get that tracking code into Adobe, we use a javascript plugin to concatenate all of those UTM values (separated with a "." delimiter) into the campaign (tracking code). For example, the URL would look like:

https:www.fakeurl.com?utm_source=fakesource&utm_medium=fakemedium&utm_campaign=fakecampaign&utm_content=fakecontent&utm_term=faketerm. The javascript plugin then transforms that to look like this in the campaign/tracking code report: fakesource.fakemedium.fakecampaign.fakecontent.faketerm. From here, we created a classification rule that separates all of them into a classification for each of the source, medium, campaign, content, and term.

The problem/question I have is that when one of those query parameters are not present, the classification rule will not run correctly because it needs to look for all 5 in order to run successfully (it looks for each of those 5 "sections" that are separated by the period and when one is not present, it breaks). Is there a processing rule I can create or a change in the classification rule that I can create in order to account for any of the missing UTM params so it eventually does get classified (essentially I have been trying to fill the missing UTM param(s) with a "null" or "does not exist" type of terminology)? Or are there any other solutions that may work?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

I think you cant fix it within your regex since you don't know which parameter is missing.

best way to fix

  • always use all parameters in tracking url (it works if maybe the last is missing, but the first 4 need to be present)
  • fix DTM to handle missing parameters, eg. replace by "none"

fix by processing rules

Maybe I can give you a solution with processing rules. I haven't used it so carefully test it before overwriting your original "campaign" variable!

-----

Rule 1: set 5 free props to "none"

  • overwrite value "prop1" with custom value "none"
  • ...
  • overwrite value "prop5" with custom value "none"

Rule 2: overwrite props with parameter value (if set)

  • overwrite value "prop1" with query string parameter "utm_source" (add condition: query string parameter "utm_source" is set)
  • ...
  • overwrite value "prop5" with query string parameter "utm_term" (add condition: query string parameter "utm_term" is set)

Rule 3: overwrite "campaign" variable (if set)

  • condition: "campaign" is set
  • overwrite "campaign" with concatenated value (parameter '.') => add all props from before

-----

How it works: basically you use 5 props as temporary savings and first set them all to "none". after this you replace the default value of your props by the corresponding utm-parameter, but only if the exists. so every prop has either "none" or the value of the parameter.

at the end you concatenate all 5 props to a single string and replace the "campaign" variable.

since I haven't tested it I strongly recommend that you first save your final string in another prop. this way you can compare the single props and the concatenated value in the database. do some testings and see if all combinations work as expected.

let me know if it works, might submit this as my next "rockstar idea" ericmatisoff

View solution in original post

4 Replies

Avatar

Community Advisor

is only a single string missing or the separator (dot) as well?

eg. if fakemedium is missing, what do you get as campaing value?

a) fakesource..fakecampaign. (skipped rest)

b) fakesource.fakecampaign. (skipped rest)

solutions:

a) add new classification rules before the existing ones and set all values to any string, eg "not set"

b) change implementation to behave like a) or change the tracking codes...

and maybe you need to change the regex for the cöassification, but can't say unless you show you're existing ones ...

Avatar

Level 1

To answer you, it would come in as "b". If one or more parameters are missing, it would look like this: fakesource.fakemedium.

Sometimes they are all set, sometimes one is missing, sometimes three are missing, etc. I am looking for a solution to account for all scenarios.

Something along the lines of IF medium, source, content are present AND campaign, term are not, then set campain and term to null (that would be one scenario of many, obviously there could be many different combos).

The current RegEx we use is as follows: ^(.+)\.(.+)\.(.+)\.(.+)\.(.+)$

I'm not a regex expert, but would anyone know how to adjust that so it would take into account values that are not present and marking it as "null"?

Avatar

Correct answer by
Community Advisor

I think you cant fix it within your regex since you don't know which parameter is missing.

best way to fix

  • always use all parameters in tracking url (it works if maybe the last is missing, but the first 4 need to be present)
  • fix DTM to handle missing parameters, eg. replace by "none"

fix by processing rules

Maybe I can give you a solution with processing rules. I haven't used it so carefully test it before overwriting your original "campaign" variable!

-----

Rule 1: set 5 free props to "none"

  • overwrite value "prop1" with custom value "none"
  • ...
  • overwrite value "prop5" with custom value "none"

Rule 2: overwrite props with parameter value (if set)

  • overwrite value "prop1" with query string parameter "utm_source" (add condition: query string parameter "utm_source" is set)
  • ...
  • overwrite value "prop5" with query string parameter "utm_term" (add condition: query string parameter "utm_term" is set)

Rule 3: overwrite "campaign" variable (if set)

  • condition: "campaign" is set
  • overwrite "campaign" with concatenated value (parameter '.') => add all props from before

-----

How it works: basically you use 5 props as temporary savings and first set them all to "none". after this you replace the default value of your props by the corresponding utm-parameter, but only if the exists. so every prop has either "none" or the value of the parameter.

at the end you concatenate all 5 props to a single string and replace the "campaign" variable.

since I haven't tested it I strongly recommend that you first save your final string in another prop. this way you can compare the single props and the concatenated value in the database. do some testings and see if all combinations work as expected.

let me know if it works, might submit this as my next "rockstar idea" ericmatisoff

Avatar

Level 1

I didn't think the RegEx would work, thanks for confirming! I will let you know what route we decide to go. I think it makes the most sense to fix the DTM logic if possible.