You are here

seoH2

Used by the following Containers: 
Variable Type: 
Custom Javascript
Grabs all H2 of the Page and makes an array with it
	function() {
    var h2 = document.body.getElementsByTagName('h2');
  	var seoH2Numbers = {{seoH2Number}};
  	
	if( seoH2Numbers == 1) {
      	// one H2 was found
      	return h2[0].innerText
    } else if (seoH2Numbers > 1) {
      	// more than one H2 found
    	var i;
  		var h2List = [];
		for ( i = 0; i < seoH2Numbers; i++ ){
    		h2List.push(h2[i].innerText)
    	}
  		return h2List;
    } else {
    	return 'no H2 on page';
    }
}