All rek.ai parameters

All rek.ai parameters

A complete list of the parameters you can add to your recommendations for filtering etc.

NameResultsDefault
data-nrofhitsNumber of hits that are rendered, alternatively sent back in the response10
data-subtreeIf only one or more grea of ​​the site is to be recommended""
data-excludetreeWhether one or more branches of the site should be excluded from the recommendations""
data-termWhether a word or phrase must be included in the page title or introduction""
data-useh1forcontentIf the page's h1 should be used when rendering instead of the page titlefalse
data-titlemaxlengthIf the page's h1 should be used when rendering instead of the page title""
data-headertextA heading that is printed above the recommendations. Ex: “Recommended reading”""
data-headerheadinglevelH-level for the header above the recommendations. If set to 0, no H tag is used""
data-headerfontclassH-tag class for the header""
data-headeridID of the header""
data-callbackThe name of a function that will be executed instead of rendering""
data-addcontentWhether content should be added to the json resultfalse
data-usecfIf and if so which custom features are to be used"all"
data-treeWhether the result should be sorted in a tree structure with parent nodes that are also sortedfalse
data-projectidUnless the default value for the project is to be used(default project id)
data-onlyprojectidIf only files with this project time should be allowed to run a predictionprojectid
data-addstripesAdds a class that creates every other color in listsfalse
data-hideimageMake sure that the image is not rendered in the function that writes contentfalse
data-renderstyleIf and how should the recommendations be rendered: list, content, advanced, tree or sort""
data-listcolsNumber of columns 1,2 or 3. Add data-renderstyle="list" to make it work with the columns.
data-linkedheaderIf the header in a tree-view should be linked to the pagefalse
data-printdateWhether publication date should be printedfalse
data-stripecolorWhat color should the biannual coloring be""
data-maxpathdepthThe maximum depth of the path page has""
data-minpathdepthThe minimum depth the path page has""
data-sortselectorSelector for example div that contains links to be sorted""
data-sortcontainersIf the sorting is also to be done on overhead containerstrue
data-pagetypeDetermines which type of pages should be recommendedCustom values ​​read via ld+json
data-notpagetypeDetermines which type of pages should not be recommendedCustom values ​​read via ld+json
data-rtSpecifies returntype: default is JSON, svauto = autocomplete for SiteVision'', 'svauto', 'flat'
data-intitleA string that must be included in the title for a hit to be recommended. Used in autocomplete.'', 'better'
date-coOverwrites which country the user is in'NO'
date-usOverwrites which city the user is in'Oslo'
date-ofOverwrites the distance the user is at (in km)1234
data-keywordsIf the term should also be checked against keywords retrieved from the spidered version of the pagetrue, false
data-returnjsonldIn case content is to be decorated with jsonldtrue, false
data-cmsIn case predictions are to be retrieved from another project and this project has a deviating cmssitevision, custom, wp, episerver, umbraco
data-domainIf a project has several domains in the same model, the parameter controls a filtering on domain'webbetjanst'
data-notdomainIf a project has several domains in the same model, the parameter controls a filtering on domains that should not be displayed'webbetjanst'
data-stylingIf the rendering of the recommendations is to use a CSS framework, the name of the framework can be specified here'envision'
data-ignorelabelsIf a project uses labels, can skip using these for a specific recommendation. Default is falsetrue, false
data-allowedlangsIf a recommendation should only recommend pages of a certain language.""
data-userootpathIf the recommendation is to be filtered based on part of the current URL-path that the visitor is on.true, false
data-rootpathlevelIf userootpath is set to true, this parameter controls the number of parts of path that control the filter.1 or 2 or 3 etc.
ldjsonfilter.[er parameter] = er valuePossibility to filter on arbitrary parmater->value combination that exists in your LD+JSON. \ If multiple are specified, all must be true for the page to be retuned.ldjsonfilter.additionalType=Physical Therapist
data-excludechildnodesWhen filtering using userootpath, we can set this flag to true to avoid including direct subpages to the current pagetrue, false
data-nrofcontextualhitsMax nr of recommendations that shall use contextual recommendations""

Explanation and respective parameter

Number of hits

data-nrofhits="5"

Control how many hits should be displayed in the list.

<div class="rek-prediction" data-nrofhits="5"></div>

Only return pages of a certain type

data-pagetype="svararticle"

By looking at the page's id and html, rek.ai can in some cases determine what type of page it is. Enter more by separating them with commas. You can also specify additional types by using json+ld.

Dont return pages of a certain type

data-notpagetype="svararticle"

It is possible to filter out pagetypes as well. Enter more by separating them with commas.

Term must be in title or introduction

data-term="school"

During the recommendation process, it is verified that the specified word or phrase is included in either the page title, introduction, or keywords.

<div class="rek-prediction" data-term="school"></div>

How should the result be rendered

data-renderstyle="content"

The result can be rendered in three different ways:

Parameter valueExplanation
listThe default way which results in a list where each LI contains an A that links to the page
contentEach hit is supplemented with an image and preamble from the recommended page. Depending on whether the page has been able to be spun correctly
treeRenders a sorted structure
sortSorts the links that already exist in a list. When rendering is complete, "rek-sorting-done" is added as a class to parent elements so they can enable the element to be displayed.
advancedLINK
pillsCreates links with the appearance often called "pill"

If data-listcols is combined with renderstyle="list" the result is formatted as a table.

Use the page's H1 instead of title

data-useh1forcontent="true"

If content is set to render, but you want the page's H1 to be used instead of title, then set this value to "true"

Limit the number of chars in the title

data-titlemaxlength="20"

If the title is longer it will just add "..."

Print a header before the recommendations

data-headertext="Discover more"

A heading that is printed above the recommendations. Ex: “Recommended reading”

Set the header tag level (h1, h2, etc.)

data-headerheadinglevel="1"

H-level for the header above the recommendations. If set to 0, no H tag is used

Add a class to the header above the recommendations

data-headerfontclass="my-class"

H-tag class for the header

Add a ID to the header above the recommendations

data-headerid="my-id"

ID of the header

Render the result via Javascript

data-callback="functionName"

If you want to manage the rendering of the recommendations yourself, you can submit here the name of the function to be executed when the recommendations have been sent to the client. The function will be run with the recommendations as input value in the form of a string.

<script>
  function customRenderPredictions(data) {
    data = JSON.parse(data);
    console.log(data);
  }
</script>
 
<div class="rek-prediction" data-callback="customRenderPredictions"></div>

If you want to know which div it was that made a prediction, you can add it to the function parameters:

Add content when rendering yourself

data-addcontent="true"

Can be set to true or omitted. If set to true, the results are decorated with the content that the system knows about the recommendations. This enables custom rendering of, for example, events or news.

How should custom features be used

data-usecf=""

You can decide which custom features are to be used for a prediction by sending the names of these in a comma-separated list. The value "none" causes none to be sent. "all" or "" causes all to be included.

Otherwise add this to decide which ones to use:

data-usecf="f1,f2"

[comment]: NO LONGER RECOMMENDED TO DO IT THIS WAY [comment]: ### Should the recommendations be returned in a tree structure [comment]:data-tree="true" [comment]: [comment]:The recommendations can be sorted according to the structure of the website. Default is false. [comment]:In order for rek.ai to be able to return the correct level on the subpages, the level must also be specified. [comment]:This is done with: [comment]: [comment]:data-treelvl="3" [comment]: [comment]:Keep in mind that the number of pages under a structure can be large, so set nrofhits to a high value. [comment]:When retrieving a tree structure, it is up to the client to manage the rendering, therefore the name of the function to render needs to be sent along. So a full-scale example can be. [comment]: [comment]:html copy [comment]:<div class="rek-prediction" data-subtree="school/" data-excludetree="/news" data-nrofhits="1000" data-tree="true" data-treelvl="3" data-callback="rendertree"> [comment]:</div> [comment]:

Sort links that already exist on the page

data-sortselector=".group-nav"

A CSS selector for the containers (divs) containing the links to be sorted. It is also possible to sort these containers internally.

Also sort overlying blocks

data-sortcontainers="true"

If the sorting is also to be done on overlying blocks.

Get recommendations with a different project time

data-projectid="xxxxxxxx"

If the website contains several projects, here you can control which recommendations are to be displayed.

Get recommendations only if this project time matches the file's project time

data-onlyprojectid="xxxxxxxx"

If the website contains several projects, here you can control which recommendations are to be displayed. But a prediction will only be retrieved if the JS file's projectid is correct. This may need to be done when you have several files on the same page, but do not want all of them to download a prediction.

Get the answer in a different format

data-rt="svauto"

If the result is to be returned in a different format than the standard one, you can add this parameter.

Parameter valueExplanation
svautoAdapted for autocomplete in SiteVision. Means that only title is returned in an array ["page 1", "page 2"]
waspAdapted to be read aloud
flatPredictions end up in a simple array. The result comes in an array that does not have the level of prediction that is otherwise included in every return object. [{prediction-object},{prediction-object}]

Check term also among keywords

data-keywords="true"

If the results are to be filtered not only against title, but also keywords.

Filter the responses that they must contain a string in title

data-intitle="job"

If the result is to be filtered on the basis that a string must be included in the title, it is possible to send this in a parameter. Used if you want to build a function with autocomplete.

If content should be sent with jsonld

data-returnjsonld="true"

Since jsonld can be large, we don't always want to send it here in content. Therefore, this parameter needs to be set to true.

If pages in a certain language should only be recommended

data-allowedlangs="en"

Rek.ai reads the "lang" attribute of web pages. If pages with specific lang attributes are to be recommended, those languages ​​can be submitted as a comma-separated string.

If pages from a certain domain should only be recommended

data-domain="municipal website portal"

Rek.ai can add external domains. The pages from these domains are added to the AI ​​model automatically. In the case of a recommendation, it is then possible to filter on these pages. To see the name of your added domain, you currently go into the Simulator in the Dashboard (opens in a new tab) and look at the bottom under domain.

dashboard.rek.ai (opens in a new tab)

If pages from a certain domain should not be recommended

data-notdomain="kommunwebbetjanportal"

Whether direct children of the current page are to be excluded

data-excludechildnodes="true"

Prevents pages at the level below the current level from being included in the recommendations. Can be used when using rootpathlevel. If you make a recommendation on the start page and use excludechildnodes, the result is:

Will not be recommend (childnode): site.com/level1.html

Will be recommend (depth 2): site.com/level1/level2.html

Get only pages back within a certain depth in the structure

data-minpathdepth="2"

When pages are retuned, the minimum depth of the page in the structure can be specified. This can be useful when you want to return all pages under a branch of the site, but only above a certain level.

<div class="rek-prediction" data-minpathdepth="3"></div>

Will not be recommend (depth 2): https://www.test.se/utbildning-och-forskola/skolbarn/forskoleklass/tider.se (opens in a new tab)

Will be recommend (depth 3): https://www.test.se/utbildning-och-forskola/skolbarn/underniva/forskoleklass.html (opens in a new tab)

The easiest way is to test the function in the console:

function myCallback(data) {
  for (var i = 0; i < data.predictions.length; i++) {
    console.log(data.predictions[i].url);
  }
}
 
var options = {
  overwrite: {
    //minpathdepth: 2,
    maxpathdepth: 3 // You can use them both to get exactly a depth
  }
}
 
window.__rekai.predict(options, myCallback);

If there is a max level from which pages should be recommended

data-maxpathdepth="2"

The level is always calculated from the domain. maxpathdepth="2" accepts the following:

Will be recommend (depth 1 and 2): /level1.html /level1/level2.html

Will not be recommend (depth 3): /level1/level2/level3.html /level1/level2/level3/level4.html

The easiest way is to test the function in the console:

function myCallback(data) {
  for (var i = 0; i < data.predictions.length; i++) {
    console.log(data.predictions[i].url);
  }
}
 
var options = {
  overwrite: {
    //minpathdepth: 2,
    maxpathdepth: 3 // You can use them both to get exactly a depth
  }
}
 
window.__rekai.predict(options, myCallback);

Filtering on values ​​in JSON-LD

data.ldjsonfilter.category="Hiking"

Or if prediction is made via Javascript:

options.overwrite['ldjsonfilter.greenEstate'] = 'true';

Example

Max nr of recommendations that shall use contextual recommendations

data-nrofcontextualhits="3"

When you make a recommendation of, for example, news, you can choose how many of these are to be recommended based on the context of the subject the article is about.