SAINT Campaign Tracking Codes (cid, cmpid, camp) - Alternate regex friendly format



Hi All,

I've recently joined an organisation who are using reasonably complex campaign tracking codes, for example:


The format of this code contains 13 regex match groups, delimited by 12 underscores (_). The issue I've found is this code is often full of mistakes, with additional underscores being added into match groups, matching groups containing no information, or matching groups being absent entirely.

The regex in Adobe's Classification Rule Builder is as follows:


which at first glance I find difficult to understand. Also, because it's relying on exactly 13 regex match groups delimited by 12 underscores, it will not match if the tracking code is different to this format.

URL Query String Alternative

I want to change the tracking code so it's both mistake resistant and regex friendly. The idea is to make a "pseudo query string" format, like you'd normally get on a URL (e.g ?name=ferret&color=purple). For example:


The regex in Adobe's Classification Rule Builder can then be setup as follows:


To match different parameters from the string, all you need to do is change the number (highlighted in red). In the rule builder the replace group will always equal $1. E.g.:

paid.*_1:([^_]+)(_)?.*    > $1 matches GEN

paid.*_2:([^_]+)(_)?.*    > $1 matches BI

paid.*_3:([^_]+)(_)?.*    > $1 matches BRAN

paid.*_4:([^_]+)(_)?.*    > $1 matches CARE


If a user enables a tracking code which doesn't exactly match the new format, the other parameters will still classify just fine. E.g.:


...will still match GEN and BI.


...will still match everything setup in your classification rules and ignore 13 and 14.


...will only break classification in 5, and not the entire key.

My question is can anybody see any issues with this? I've searched far and wide and haven't found anyone using this approach.

Kind Regards,


Accepted Solutions (1)

Accepted Solutions (1)




Brandon, this looks like an amazing solution to your problem.

Eventually you may want to make sure all the data is coming correctly, but this solution beautifully incorporates a great safety factor.


Answers (0)