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.
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.
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?
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
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 (?)
"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]
Thanks. Where can I find that "element exists"?
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.
Obviously there are many different ways to do this, since the http status code is not a built-in criteria in the rules.
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";