Month: July 2017

wordpress

Displaying category description in archive page wordpress

<?php the_archive_description( ‘<div class=”taxonomy-description”>’, ‘</div>’ ); ?>   Reference : https://developer.wordpress.org/reference/functions/the_archive_description/

Jquery & Javascript

How to check if element exists in the html page using javascript?

Suppose it is a div with id “slots” then in jquery: if( $(“#slots”).length < 1 ) { console.log(“Div is not present”); }else { console.log(“Div with id #slots is present”); } its is more if we write any div dynamically.

General

How to call tag manager code in infinite scroll website pages?

Infinite scrolling pages, means at the end of a page next page will be loaded. This is latest trends in websites now. Especially in news website. Here we added instruction to track these infinite page scroll analytics using google analytics. Here we creating an event to get google analytics details while page scrolls: Event name…

General

How to create a custom event in google tag manager

Here we creating an event to get google analytics details while page scrolls: Event name :Scrollview Variables :pageurl, pagetitle dataLayer.push({ ‘event’:’Scrollview’, ‘pageurl’:titleurl, ‘pagetitle’:title }); This should be called wherever you need to trigger the event, in this case while page scrolling. Using this variable and event we need to configure an event in google tag…

General

Datalayer.push in google tag manager

dataLayer.push({    }); dataLayer.push javascript snippet is used to push details to Google tag manager. We can create a event and variables required for this/ dataLayer.push({ ‘event’:’Scrollview’, ‘pageurl’:titleurl, ‘pagetitle’:title }); Here we creating  an event called “ScrollView” , pageurl and pagetitle are variables we need to push to tag manager. Using these variable and event we…

General

Google tag manager

Google tag manager is used to add tags used in the website. Eg: Analytics, Any other tracking code, etc.. We can provide all those data in a single console provided by the tag manager. https://tagmanager.google.com/ Here we need to create an account with our website details.  This is what is called “Work space” in tag…

Jquery & Javascript

last element in an array using java script

arrayname.slice(-1)[0]; arrayname.slice(-1).pop();