Webanizr Logo
Open / sluit menu
Plugin urlProperties

Last change: May 19, 2020

Current version: 1.3.3

Checks if the url the plugin is called from meets the required specifications and then calls the callback function.

syntax

webanizr.collect('urlProperties', checks, callback);

checks

An array of checks to perform on the browser. If one of the checks match, the callback function will be called. Example:

[ "url:demo == 5", "get:skip exist true", "fragment:test == 7" ]

Every check consists of three parts: variable, operator and value. The variable can be from the path part of the url, starting with "url:", or from the query string part of the url, starting with "get:" or a fragment part of the url starting with "fragment:".

The following operators are allowed:

  • ==
  • !=
  • >
  • <
  • >=
  • <=
  • exists (does a variable exist)


If no checks are given, the callback is always called. This way, the plugin can be used to collect information on the url. To collect all information on the url, vars__all can be used. The order of the variables are; url variables, get variables, fragment variables. And if there's no '__' notation of any url. get or fragment variable; '__url', '__get' or '__fragment' will be automatically added to the end of each url property.

callback

The callback function is called if at least one of the checks pass. As data the plugin sends information on the url.

demo

https://cdn.cpmodules.webanizr.com/demo/urlProperties4/index.html?test=5#test=7

  • May 19, 2020 - 1.3.3 - removed unnecessary console.log
  • March 31, 2020 - 1.3.2 - added dots between the words of subdomain
  • March 31, 2020 - 1.3.1 - changed slice with pop
  • March 31, 2020 - 1.3.0 - domain vars added to the vars__all
  • November 27, 2019 - 1.2.1 - vars__all added