Jump to content

How to create push data layer for GTM


Eduard J
 Share

Recommended Posts

Hi,

I'm facing trouble to implement push data layer code for each page I want to track via GTM. Want to create funnel from add to basket ---> purchase through out the all stages.

Here is so far what I have and it is showing as custom event in GTM, but I'm unable to get information such as product name, qty, item price etc.

{literal}
<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
dataLayer.push({
'item': 'how to pull from page',
'quantity': 'how to pull from page',
'value': 'how to pull from page',
'event': 'begin_checkout'
});
</script>
{/literal}

 

If anyone has experience with this I would appreciate sharing it. 
Thanks 

Link to comment
Share on other sites

  • 3 months later...

Posted (edited)

dataLayer = window. dataLayer || []; dataLayer. push({ 'event' : 'trackEvent', 'pageType' : 'Blog', 'userID' : '12345', 'loginStatus' : 'logged in' }); Note: while event keys aren't strictly necessary for a data layer push, every tag in GTM needs an event key to trigger it. JCPenneyKiosk

Edited by Curtis69
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...