Code Monkey home page Code Monkey logo

analytics-wordpress's People

Contributors

anoonan avatar bbeaird avatar bitdeli-chef avatar brennan avatar causehacker avatar dianahsmith avatar hankim813 avatar ianstormtaylor avatar justinsainton avatar reinpk avatar sperand-io avatar

Stargazers

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

Watchers

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

analytics-wordpress's Issues

url redirect issue

Hey @JustinSainton, from convo in support:

I do have a question. I integrated into WordPress with a WooCommerce store. When I have the Segment plugin activated, ordering a product creates this URL which doesn’t work:

http://attractionsmagazine.com/store/?add-to-cart=52

It should have gone to

https://attractionsmagazine.com/checkout/

Do you have any clues about that? None of the integrations are active for troubleshooting purposes.

Do you have any ideas here or know what's up?

Add Custom User Role Support

The current iteration of the plugin's ability to only track certain user roles depends on the "user_level" property of the WP_User object - a property (and concept) that has been deprecated in favor of the roles and capabilities APIs in WordPress.

By using the native and newer APIs, we'll be able to accommodate more fine-grained control here, as well as support custom users and roles that are created by third-party plugins. This would prove especially helpful for eCommerce plugins like WP eCommerce, WooCommerce and Easy Digital Downloads - all of which add custom user roles.

update snippet

use the most recent Analytics.js snippet:

<script type="text/javascript">
window.analytics=window.analytics||[],window.analytics.methods=["identify","group","track","page","pageview","alias","ready","on","once","off","trackLink","trackForm","trackClick","trackSubmit"],window.analytics.factory=function(t){return function(){var a=Array.prototype.slice.call(arguments);return a.unshift(t),window.analytics.push(a),window.analytics}};for(var i=0;i<window.analytics.methods.length;i++){var key=window.analytics.methods[i];window.analytics[key]=window.analytics.factory(key)}window.analytics.load=function(t){if(!document.getElementById("analytics-js")){var a=document.createElement("script");a.type="text/javascript",a.id="analytics-js",a.async=!0,a.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.io/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n)}},window.analytics.SNIPPET_VERSION="2.0.9",
window.analytics.load("API_WRITE_KEY");
window.analytics.page();
</script>

add `userId` option

so people can choose to identify users by the WP userId or username in addition to the email which is the current standard

@ianstormtaylor what do you think?

Another WooCommerce Fatal Error

Getting: Fatal error: Call to a member function get_cart() on a non-object in /home/action/workspace/www/wordpress/wp-content/plugins/analytics-wordpress/integrations/ecommerce/woocommerce.php on line 214

WooCommerce SKU fatals

From the WordPress.org forums:

I'm working on a wordpress/woocommerce development - I've just installed the updated segment.io plugin (v 1.0.0) to track woocommerce events but am now seeing:

Call to a member function get_sku() on a non-object in /Users/JR/Sites/Edapt/subdomains/www/htdocs/plugins/segmentio/integrations/ecommerce/woocommerce.php on line 146

So none of the tracked events once in the cart are coming over to segment.

We're running variable cost by attribute subscription products and all SKU's are defined

custom fields in identify?

From a support ticket:

If there's a way to get the phone field in Pardot from the Checkout form, would it be possible then too to also retrieve the name and email? Or do they work differently? Sorry, when it comes to handling form data I am an extreme novice. Thank you for all your help.

Is there a way for us to get custom data like phone numbers of a user, or similar, into the identify call we are making? Right now I think we are just tracking WordPress default things like firstName and lastName?

cc @JustinSainton

library context doesn't get added to page calls

Looks like the library name isn't being populated in the context for page calls, whereas for track and identify it is. Ends up looking like this when it's there:

{
  "context": {
    "library": {
      "name": "analytics-wordpress"
    }
  }
}

cc @JustinSainton if you can check this out.

Secure mode language is confusing

image

Intercom calls this "Your secure mode secret", but here it's called both the "Intercom API Secret" and "your Intercom API key". However, Intercom also gives you "A read, write API key".

If I'm understanding correctly, the thing that should actually be saved here is what Intercom calls "Your secure mode secret" – is that correct? If so, I suggest standardizing on their language πŸ˜„

Abstract anonymous user handling from eCom platforms

In order to take care of #27, we need to ensure an anonymous ID is always created. I think analytics.js already has a way to do this, but need to check with @ianstormtaylor.

If so, we should take advantage of it. If not, we can abstract that functionality from the eCom platforms, some of which already have helpful methods to accomplish this.

Notice on activation

Notice: Undefined index: track_searches in /srv/www/wordpress-develop/src/wp-content/plugins/analytics-wordpress/analytics-wordpress.php on line 914

Add Intercom Secure Mode support

Intercom Secure Mode is currently unsupported. Would be great if the hash could be defined in your Wordpress settings (and loaded for doing the identify command).

Include Pages with Viewed Post calls, have an option to disable Viewed {tite} Page calls

I'm really suprised noone mentioned this.

The function of the plugin which tracks Pages as individual .track() calls is very very very annoying.
If you have a lot of pages, it literally floods your event list, and makes managing these events a pita.

I would like a way to turn this off (even if by filter) and then include these pages in the Viewed Post track() calls since technically every Page is a Post with a post_type == 'page' in the database so they are all of the same event, some are just Posts and others are Pages and then we have custom post types.

It doesnt make sense why custom post types are tracked by View Post but Pages are not.

I have to end up making my own custom calls per Page just to track those accurately and effectively.

add e-commerce support

We'll want to support woocommerce for sure, but maybe WP e-commerce, jigoshop, etc. Need some guidance here from a WP expert.

Proper Documentation

Give methods, functions, actions and filters proper PHP Doc blocks.

Give filters and actions developer tips and examples in the readme of how to properly extend and use.

product_id is a hash key, not an object property

Changing $item->product_id to $item['product_id'] in woocommerce.php:296 and woocommerce.php:301 fixes this problem:

PHP message: PHP Notice: Trying to get property of non-object in {path}/web/app/plugins/segmentio/integrations/ecommerce/woocommerce.php on line 296

PHP message: PHP Notice: Trying to get property of non-object in {path}/web/app/plugins/segmentio/integrations/ecommerce/woocommerce.php on line 301

page() called twice ?

I've seen some data that suggests that each project sends two .page() calls, one is library: analytics.js and the other is library: analytics-wordpress.

I'm guessing the library: analytics.js is from the snippet and library: analytics-wordpress is here

Running on localhost

Hey,
I'm trying to test this out on a locally hosted wordpress site. The problem is, it's not working. Instead of getting a normal window.analytics, I get this array:
[["page"], ["identify", "[email protected]", {username: "root", email: "[email protected]"}, {library: "analytics-wordpress"}], ["track", "Viewed Post", {title: "Hello world!", category: "Uncategorized", noninteraction: true}, {library: "analytics-wordpress"}]]
Nothing is getting pushed to the Segment server. Any ideas what I could be doing wrong?
Note: I have the correct API key and everything is checked to track in the settings page.

API Key Details

Add more detail about how to find the API Write key in the wordpress plugin. It can be found in Project Settings > Api Keys. And it should be called Write key too :)

Analytics.identify() should not be called on every page view

If i am not mistaken, analytics.js tracks a user's session via the Analytics cookie. The identify() method should thus only be called ONCE when the user has been identified (on log-in or sign up).

Currently the identify() method is unconditionally called on every page view for logged-in users, sending the complete users personal data with each and every HTML response.
https://github.com/segmentio/analytics-wordpress/blob/master/analytics-wordpress.php#L537-L550

This not only results in HTML code overhead but introduces privacy/security concerns:
Many websites would force HTTPS for pages that contain confidential/personal data (e.g. on the user's dashboard, account page). The current code renders such security precautions useless, as it will include the users personal information in every HTML response, even while the user is viewing pages that are not expected to contain any personal information and would as such not necessarily be secured by HTTPS.

Build core + integrations test suite

The plugin should have a proper unit test suite that can be run via command line in a Vagrant setup. Any integrations (eCom or others) should have similar test suites.

support for group method?

Is there any way to use the group method, or is that not possible since the plugin relies on analytics.js?

Woocommerce "Add to Cart" cause PHP Fatal Error

Hi there,

I downloaded the plugin and installed on my woocommerce store. Once I click the "Add to Cart" button on the products, it showed up a PHP Fatal Error, please see log below:

[Thu Oct 09 03:01:36.380979 2014] [:error] [pid 21246] PHP Fatal error: Call to undefined function WC() in /wp-content/plugins/segment-analytics/integrations/ecommerce/woocommerce.php on line 107

Add support for custom post types

While we have added the proper actions necessary to track any event for plugin developers, we could/should add some UI for users to be able to track CPT/CT activity.

Support for WordPress Multisite

Are there any plans to incorporate support for WordPress Multisite? It would be awesome to be able to "network activate" the plugin and have analytics installed on every site in the network.

Use proper Settings APIs

I found, through the course of refactoring the plugin, that the settings screen was not using the proper settings API. As such, it actually ended up unnecessarily re-saving the options array to the default options array on every page-load. By using the proper API, it will fix this.

name pages from page/post editor

add a box on the post/page editor for optional "name" and "category" so if the post title is "10 Simple SEO Tips" but they enter "SEO Tips" into the post name and "Marketing" into the category, then when someone views the page fire this track call:

analytics.track('Viewed Post', {
  title: '10 Simple SEO Tips',
  name: 'SEO Tips',
  category: 'Marketing',
  noninteraction: true
});

If they don't enter anything then the title and name will be the same and the category will pull from the category or categories that the post belongs to, so if the post belongs to the Marketing and SEO categories:

analytics.track('Viewed Post', {
  title: '10 Simple SEO Tips',
  name: '10 Simple SEO Tips',
  category: 'Marketing, SEO',
  noninteraction: true
});

Pages will be done in a similar way...

If a page name and category are defined in the page editor page:

analytics.track('Viewed {{page.name}} Page, {
  title: {{page.title}}, // the full title of the page
  url: 'https://segment.io/team',
  path: '/team',
  referrer: 'https://segment.io/',
  name: {{page.name}} || {{page.title}}, 
  category: {{page.category}}, // null if not specified
  noninteraction: true
});

@ianstormtaylor does this all look ok to you?

Add support for WP eCommerce 2.0 theme engine.

WP eCommerce 3.9 ships with a new not-back-compat theme engine that is loaded conditionally. Once it lands, we should review compatibility and make any changes necessary to support it.

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.