If user goes to url that doesn't exist and then the browser gets status code 404 error aka page not found. If that happens, I would then like to save "errorpage" to s.pageName and the status code "404" to eVar5. Any ideas which would be the easiest or the best way to do this with dynamic tag management? I didn't see any rules for status codes in the "page load rules" section. Do I have to again (!) make some kind of custom script? Thanks for all the help.
Solved! Go to Solution.
Views
Replies
Total Likes
Have you used the DTM debug mode to verify that your rule is actually firing? If the rule is not firing at all, something within the Conditions section is incorrect. If the rule is firing and your tag is not, then you'll want to double-check your custom code.
You can enter _satellite.debug(true); into your developer console to turn on debug messages.
Views
Replies
Total Likes
To track pages like this, you would want to make sure you have DTM code embedded on your 404 error page. Then create a DTM page load rule based on a unique identifier for this page type. For example, if the URL contains "404error", then use the Path criteria in your Condition and set "404error" in the value field.
Then in the Adobe Analytics section of the rule, you can set your eVar5 in the UI. You should not set the pageName as errorType, because error pages are tracked in a separate variable called pageType. You can use the Custom Page Code editor and enter this to track the error pages:
s.pageType = "errorPage";
Views
Replies
Total Likes
The problem is that url does not contain any unique information about 404 error. We can have http status code 404 on any url that does no exist. Of course we have unique 404 error image and with that I can create rule, but what if somebody change the image name/url. It would be much more reliable if I could make this kind of rule "if http status code is 404 then fire my rule X", but this is not possible? Maybe it's again possible to do some kind of custom script that fires my rule if http status code is 404. Have use Google to find help to make this kind of custom javascript, if you can't tell directly? =)
Views
Replies
Total Likes
Yes, you could write some custom script in the Conditions > Criteria > Custom Code section and return true only if you detect the 404 http status code.
If you can standardize the page in someway to have a consistent identifier, like a query string parameter or javascript object that reflects the http status code, you could use that in a Data Element and look for that in your Conditions. If the 404 image on the page was consistent, you could use "element exists" criteria and use a CSS selector to look for that image.
Obviously there are many different ways to do this, since the http status code is not a built-in criteria in the rules.
Views
Replies
Total Likes
Thanks. Where can I find that "element exists"?
Views
Replies
Total Likes
"element exists" is in the Event criteria drop down within an Event Based Rule.
[img]Screen Shot 2013-11-15 at 11.17.20 AM.png[/img]
Views
Replies
Total Likes
Thanks Rudi. Don't get it to work anyway. If I want fire my "404" rule based on "404 image" exist, then what should I put to
"Element Tag or Selector" = img (?)
" = src (?)
"Value"= 404.jpg (?)
Not working.
Views
Replies
Total Likes
That should work if the path for your 404 image contains "404.jpg". Here is a reference on selectors so you can be sure you're using the correct syntax: http://www.w3schools.com/cssref/css_selectors.asp
Views
Replies
Total Likes
Yes, I did like that, although that was just an example. But still don't get it to work.
Let's walkthrough this.
Our image: <img src="/folder1/folder2/images/404_head.png">
I can do this with event based rules, so no data element is needed?
event type: element exists
Apply event handler directly to element (didn't check)
Element Tag or Selector: img
Checked "Manually assign properties & attributes" and added, property: src and value: 404_head.png (no regex)
And I have to add some kind of rule?
Views
Replies
Total Likes
Have you used the DTM debug mode to verify that your rule is actually firing? If the rule is not firing at all, something within the Conditions section is incorrect. If the rule is firing and your tag is not, then you'll want to double-check your custom code.
You can enter _satellite.debug(true); into your developer console to turn on debug messages.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies