DTM: How to make only one rule to save friendly page name on every page

Antti_Ko

15-10-2015

Hi,

Started to use DTM with SiteCatalyst. Just testing on one report suite and let’s see how it works. At this point not really sure do we need the tag management. The setup with SiteCatalyst was quite easy to do and now my suite is collecting data ok. Now the real works aka tagging starts and lots of newbie questions in my mind. Let’s start with the first one.

I would like to save friendly name to SiteCatalyst (s.pageName). I could use the url path for this. If we have over 100 pages on our site then it would be really time consuming to make rule (to pageName) for every page. What would be the correct/easiest thing to do this with only one rule/script, possible?

For example, http://www.example.com page name could be “/”. http://www.homepage.com/category/cars/ page name would be “category/cars” so I want always save the folder path to s.pageName.

Thanks for all the help.

Accepted Solutions (1)

Accepted Solutions (1)

salomepb

15-10-2015

By default Site Catalyst will use the path for the page name if nothing else is specified; so for this, no action is required. However, if in the future you wish to set the page name to some other value available on the page, the best method would be to grab that value in a data element and then set the page name to that data element within a page load rule like this %dataElementName% (see attachment for reference).

Hope this helps! Just let us know if you need any further clarification.

Answers (6)

Answers (6)

salomepb

15-10-2015

Data elements in DTM make it easy to use the data available on your site. There is some dependency on the website code to provide the right values in some form whether it be an <h1> tag or a query string parameter or a JS object; however, if the data is available and can be targeted then it can be stored in a data element and leveraged within DTM. It's worth noting, however, data elements in DTM are only populated with data if referenced in a rule or in a custom script. Here's a helpful resource that may help you understand data elements a little better: https://microsite.omniture.com/t2/help/en_US/dtm/#Data_Elements

Just let me know if you still have questions!

Antti_Ko

15-10-2015

"Related to this. Wanted to test custom script. See my attachments. I did that, added that in the rule, saved and published. But the pagename is always "n/a" and not "testing". Any idea what did I do wrong?"

Starting to learn when I'm able to answer my own questions. 😃 Ok, so you can't put directly s variables to there or something. Custom code is for real "hard" javascripts, like this for my channel (and now this works the way I want to): See attachment.

So my only question/wondering is this anymore:

"Ps. Still bit confused about these data (layer) elements. I thought I would always have to hard code these data elements to our site, but now I was able to do data element directly from DTM. Could be that I'm mixing two different things!? No need to comment, just wondering out loud. Have to study more."

Antti_Ko

15-10-2015

"I was able to do what I wanted with that window.location.path, but what if I want to make exception to only frontpage? I mean the page name for my frontpage would be only "/", but would be nicer if it was friendly name like "homepage". I guess I would have to make some kind of custom script with "if else" commands to make this happen. Have to investigate that, but any tips are welcome?"

I managed to do that. I had to make custom script. See attachment. (I guess everything is possible with custom script)

Antti_Ko

15-10-2015

I was able to do what I wanted with that window.location.path, but what if I want to make exception to only frontpage? I mean the page name for my frontpage would be only "/", but would be nicer if it was friendly name like "homepage". I guess I would have to make some kind of custom script with "if else" commands to make this happen. Have to investigate that, but any tips are welcome?

Related to this. Wanted to test custom script. See my attachments. I did that, added that in the rule, saved and published. But the pagename is always "n/a" and not "testing". Any idea what did I do wrong?

Antti_Ko

15-10-2015

Thanks salomePB. By "path" I meant only the folder structure (category/page) and not the whole url address (which is the default value for SiteCatalyst).

Anyway, thanks for your tip, and now I was able to do what I wanted. See my attachments.

Ps. Still bit confused about these data (layer) elements. I thought I would always have to hard code these data elements to our site, but now I was able to do data element directly from DTM. Could be that I'm mixing two different things!? No need to comment, just wondering out loud. Have to study more.