This plugin requires WooCommerce to operate. Instrumenting analytics for your cart should be straightforward and use standard JavaScript. This plugin aims to solve this to allow you to use your own JavaScript or a tag management solution to integrate your analytics tracking. The idea is that the page outputs the variables you need, sanitized and ready to consume in JavaScript, and you simply pass them along to the analytics packages.
This plugin does not do anything except publish the values you need as JavaScript variables; to make it useful you need to incorporate it into an analytics package and refer to the variables.
Currently, it populates the global variable
window.WCPAYLOAD
with an object structure which, at a minimum, has a member
type
which determines the structure.
The possible values for
type
are:
cart
checkout
order-confirmation
The types
cart
and
checkout
are nearly identical and place the majority of the values in the
cart
member.
order-confirmation
is similar, but places the majority of the values in the
order
member.
You can view the source file
output-samples.php
in the plugin directory to see samples of the structure that is output. Values and types should be self-explanatory, they are output directly using
WooCommerce API calls.
Contribute
Github
Author
Kent Davidson
Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation and then activate the plugin from Plugins page.
There is currently no configuration of this plugin, but to confirm it's working you can view the source of the cart, checkout, and order confirmation page and look for a global variable called WCPAYLOAD on the page. If you find it, it's working.
Minimum Requirements
- WooCommerce 2.0
- PHP version 5.3 or greater
Version 1.0.2 (27-July-2018)
- Version bump didn't seem to take, so trying again with new version number.
Version 1.0.1 (25-July-2018)
- Fixed issue with
customer
value not being populated for guest orders. Updated readme.txt
to fix layout issue.
Version 1.0.0 (10-July-2018)