1 person found this helpful
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)
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 ...
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"?
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
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.