You can set categories to any page on your website and use this category with N.Rich analytics. N.Rich Website tag allows two ways to perform this:
-
Define page category using the tag configuration
-
Define page category using Javascript on the page
For correct operation, you should use 'UTF-8' encoding on the page. Otherwise, any non-Latin symbols will be corrupted. The page category must not be longer than 75 characters.
Define page category via tag configuration
Sample of default N.Rich Website Tag code:
var config = {
cookieless: true,
};
!function(n,a,t,i,f,y){n[t]=n[t]||function(){(n[t].q=n[t].q||
[]).push(arguments)},n[t].l=1*new Date,f=a.createElement(i),f.async=true,y=a.getElementsByTagName(i)[0]
,f.src='https://serve.nrich.ai/tracker/assets/tracker.js?'+t,y.parentNode.insertBefore(f,y)}
(window,document,'nt','script'),nt('load','{tag_uuid}', config);
</script>
page_category
parameter to mark this page with the desired category. example:var config = {
cookieless: true,
page_category: 'Automotive',
};
!function(n,a,t,i,f,y){n[t]=n[t]||function(){(n[t].q=n[t].q||
[]).push(arguments)},n[t].l=1*new Date,f=a.createElement(i),f.async=true,y=a.getElementsByTagName(i)[0]
,f.src='https://serve.nrich.ai/tracker/assets/tracker.js?'+t,y.parentNode.insertBefore(f,y)}
(window,document,'nt','script'),nt('load','{tag_uuid}', config);
</script>
Define page category via a Javascript function call
N.rich Website Tag adds a special function to the page to perform additional actions. The name of the function is nt
. You can use this function to define the page category as an alternative to using the tag configuration. This function will be available on any page including N.Rich Website Tag and may be called anywhere on the page once the page has loaded. Usage example of the function:
The function will add the specified page category and can be called several times. If called several times, each call will update the page category to a new value. Example:
nt('set_meta', 'page_category', 'example_category2');
nt('set_meta', 'page_category', 'example_category3');
example_category3
as specified in the last call.The function also will override the configuration value if specified. For example:
var config = {
cookieless: true,
page_category: 'Automotive',
};
!function(n,a,t,i,f,y){n[t]=n[t]||function(){(n[t].q=n[t].q||
[]).push(arguments)},n[t].l=1*new Date,f=a.createElement(i),f.async=true,y=a.getElementsByTagName(i)[0]
,f.src='https://serve.nrich.ai/tracker/assets/tracker.js?'+t,y.parentNode.insertBefore(f,y)}
(window,document,'nt','script'),nt('load','{tag_uuid}', config);
</script>
<script>
nt('set_meta', 'page_category', 'Business');
</script>