Code Monkey home page Code Monkey logo

woocommerce-order-datalayer's Introduction

Woocommerce Order to Datalayer

Pushes completed orders into a javascript object named datalayer into the wp_head() for Google Tag Manager to use. Outputs the order details into the dataLayer on the receipt page then sets a meta value into order post called _ga_tracked so the dataLayer is not outputted twice if the user refreshes.

Requirements

  • Wordpress 4.0+
  • Woocommerce 3.0+
  • PHP 5.6+

Install

Via Composer

composer require framecreative/woocommerce-order-datalayer

Manually

Download and install into your plugins folder

Features

  • Use filter woocommerce_order_datalayer to add objects to the dataLayer before it is outputted.
  • Adds order meta to track that the dataLayer has been triggered already.

DataLayer contains:

  • transactionId
  • transactionDate
  • transactionType: 'sale'
  • transactionAffiliation
  • transactionTotal
  • transactionShipping
  • transactionTax
  • transactionPaymentType
  • transactionCurrency
  • transactionShippingMethod
  • transactionPromoCode
  • ecomm_totalvalue
  • event: 'orderCompleted'
  • ecomm_prodid: [ids]
  • ecomm_pagetype: 'purchase'
  • transactionProducts:
    • id
    • name
    • sku
    • category
    • price
    • currency
    • quantity

woocommerce-order-datalayer's People

Contributors

jackmcpickle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

woocommerce-order-datalayer's Issues

Help to call datalayer

Hi! I've added the line bellow to my checkout page, but in Tag Manager inspector, can't see the data layer values:

Can you help me?
Thank you!

Congratulation for you code!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.