Skip to content

Instantly share code, notes, and snippets.

View joselazovargas's full-sized avatar

Jose Lazo joselazovargas

  • Australia
View GitHub Profile
@joselazovargas
joselazovargas / Wordpress Data Layer Variables
Last active March 6, 2018 16:38 — forked from BryanBarrera/Wordpress Data Layer Variables
Modified Wordpress datalayer variables for pulling: author names, post types, categories, page name, and dates into custom variables for the classic version of Google Analytics. Feel free to leave a comment or hit me up http://BryanBarrera.com
// Add this script after you make your dataLayer = []; call
// AND after your GTM code snippet
// This needs to go inside the header.php in order for it work globally across your site
<script type="text/javascript">
// URL toolbox - helps grabbing elements in the URL
var _d = document;
var _dl = _d.location;
var _dlp = _dl.pathname;
var _dls = _dl.search;
var _dr = _d.referrer;