I have s.campagin implemented in Adobe Launch extension code for Adobe Analytics for s.campaign . When there are utm values , s.campaign populates fine, but when there are no values it shows in s.campaign it shows null values
e.g. s.campaign: null|null|null|null
How do I remove the null not showing in the debugger and in reporting?
if (!s.campaign) {
s._utm_campaign = s.getQueryParam('utm_campaign');
s._utm_source = s.getQueryParam('utm_source');
s._utm_medium = s.getQueryParam('utm_medium');
s._utm_term = s.getQueryParam('utm_term');
s._utm_content = s.getQueryParam('utm_content');
s.campaign = s._utm_source + "|" + s._utm_medium + "|" + s._utm_campaign + "|" + s._utm_term + "|" + s._utm_content;
if (s.campaign === "||||") { s.campaign = "" }
}
Solved! Go to Solution.
Views
Replies
Total Likes
Try this:
if (!s.campaign) { s._utm_campaign = s.getQueryParam('utm_campaign'); s._utm_source = s.getQueryParam('utm_source'); s._utm_medium = s.getQueryParam('utm_medium'); s._utm_term = s.getQueryParam('utm_term'); s._utm_content = s.getQueryParam('utm_content'); s.campaign = s._utm_source + "|" + s._utm_medium + "|" + s._utm_campaign + "|" + s._utm_term + "|" + s._utm_content; if (s.campaign === "||||" || s.campaign === "null|null|null|null|null") { s.campaign = "" } }
or better yet:
if (!s.campaign) { s.campaign = [ s.getQueryParam('utm_source'), s.getQueryParam('utm_medium'), s.getQueryParam('utm_campaign'), s.getQueryParam('utm_term'), s.getQueryParam('utm_content'), ].map((u) => { return (!u || u === 'null') ? '' : u; }).join('|'); if (s.campaign === "||||") { s.campaign = ""; } }
Views
Replies
Total Likes
I'm not entirely sure why all your variables are being declared within the s object.... s.campaign is an actual tracking parameter and falls within the s object scope...
Things like s._utm_campaign do not...
Same with adding the s object to the getQueryParam function... you shouldn't need the s object to be applied here.
I suspect the issue may come from a combination of these two unnecessary declaration into an invalid scope... there is no s._utm_campaign variable, there is no s.getQueryParam function, and by attempting to populate this way is causing confusion in the concatenation.
Try instead:
if (!s.campaign) { var _utm_campaign = getQueryParam('utm_campaign'); var _utm_source = getQueryParam('utm_source'); var _utm_medium = getQueryParam('utm_medium'); var _utm_term = getQueryParam('utm_term'); var _utm_content = getQueryParam('utm_content'); s.campaign = _utm_source + "|" + _utm_medium + "|" + _utm_campaign + "|" + _utm_term + "|" + _utm_content; if (s.campaign === "||||") { s.campaign = "" } }
Views
Replies
Total Likes
Thank you very much. I was not using getQueryParam and that worked fine.
Views
Replies
Total Likes
Try this:
if (!s.campaign) { s._utm_campaign = s.getQueryParam('utm_campaign'); s._utm_source = s.getQueryParam('utm_source'); s._utm_medium = s.getQueryParam('utm_medium'); s._utm_term = s.getQueryParam('utm_term'); s._utm_content = s.getQueryParam('utm_content'); s.campaign = s._utm_source + "|" + s._utm_medium + "|" + s._utm_campaign + "|" + s._utm_term + "|" + s._utm_content; if (s.campaign === "||||" || s.campaign === "null|null|null|null|null") { s.campaign = "" } }
or better yet:
if (!s.campaign) { s.campaign = [ s.getQueryParam('utm_source'), s.getQueryParam('utm_medium'), s.getQueryParam('utm_campaign'), s.getQueryParam('utm_term'), s.getQueryParam('utm_content'), ].map((u) => { return (!u || u === 'null') ? '' : u; }).join('|'); if (s.campaign === "||||") { s.campaign = ""; } }
Views
Replies
Total Likes
Thank you for the concise version. Appreciate it. Very helpful.
Below solved the issue for me
f (s.campaign === "||||" || s.campaign === "null|null|null|null|null") { s.campaign = "" } }
Views
Replies
Total Likes
Unfortunately, this won't prevent s.campaign from resulting in "value 1|value 2|null|null|null" etc, IF not all UTMs are provided in the URL.
If you want non-values to be treated as nothing and not null, (i.e. "value 1|value 2|||") this solution won't work.. it really only covers the "all or nothing" scenario
Views
Replies
Total Likes
Thank you very much!! Will try that out
Views
Replies
Total Likes
After doing that change, I went ahead and classified the s.campaign variable to point to those values. See Screenshot 1. But, below variables are not showing any data in Analysis Workspace . It shows unspecified. See Screenshot 3.
The tracking code report is showing the data in Analysis Workspace. See Screenshot 2
SCREENSHOT 1
SCREENSHOT 2
Views
Replies
Total Likes
Classification rules only process every 4-6 hours... and if you just created the classifications it can take up to 24 hours for the classifications to process the lookback window.
Views
Replies
Total Likes
Also, you mentioned that you had configured the Classifications, but you didn't mention if you had actually imported any classifications data or are using Classification Rule Builder. If you have not done any of the latter, then obviously there won't be any classifications for AA to map to.
Views
Replies
Total Likes