GithubHelp home page GithubHelp logo

isabella232 / myna-wordpress Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pardot/myna-wordpress

0.0 0.0 0.0 467 KB

An open-source WordPress plug-in for Myna (http://mynaweb.com/)

JavaScript 11.02% PHP 88.98%

myna-wordpress's Introduction

Myna for WordPress

Manage and utilize the new Myna API from inside WordPress and get instant web content optimization!

Description

Integrate the new web content optimization API from Myna and let your best content automatically display according to real user data. With this plugin, you can manage all of your interactions with Myna from within the Admin area of WordPress (including viewing data), saving you time: create and manage experiments and variables, integrate content suggestions through shortcodes or template functions, and automatically return the value to Myna.

Why Use Myna?

From MynaWeb.com:

Myna is:

  • Simple — you don’t need to make any decisions about experimental parameters before you begin, and you don’t need to know any stats to interpret the results.
  • Flexible — you can add and remove page variations at any time. Adaptable — Myna reacts to changes in customer preferences automatically. You don’t have to lift a finger.
  • Fast — Myna optimizes your page right from the start. There’s no need to wait for experiments to finish before making a decision.

Installation

  1. Upload the myna-for-wp folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the 'Plugins' menu in WordPress.
  3. Add login information to the settings page (Settings > Myna).
  4. Add experiments and variables on the settings page as needed.
  5. Use the shortcode in your posts and pages, use the myna_link function in your template file, or use the more advanced get_myna_var function.

Shortcode

The shortcode allows you to place a dynamic Myna link in a post (of any type) or page. The options are:

[myna uuid="string" link="string" newwin=boolean]Link Text[/myna]

  • 'uuid' is your Myna Experiment UUID.
  • 'link' is where your created link will point (href).
  • 'newwin' is a true/false that will make the link open in a new window (target="_blank").

The content between the shortcode brackets is the default link text. This is what will appear if a user has JavaScript disabled, as your Myna suggestion will replace this text after the page loads. It's a good practice to put one of your potential suggestions here to minimize the visual change. If you don't put anything in here, the default text will be 'Click Here'.

So, for intance:

[myna uuid="72a3dd4f-73f2-4a18-a99f-a14a6b3e8e0d" link="http://google.com" newwin=true]Testing This[/myna]

produces:

<a href="http://google.com" rel="72a3dd4f-73f2-4a18-a99f-a14a6b3e8e0d" target="_blank" class="mynaSuggest">Myna Suggestion (which replaced Testing This)</a>

Main Template Function

This is the same function as the shortcode, but designed to be used in theme/template files. Using the same guidelines as above, the options are:

myna_link($uuid,$link,$text='Click Here',$newwin=false)

The only difference is that the default text (to be replaced on load by a Myna suggestion) is the third parameter in the function. So, for instance:

myna_link('72a3dd4f-73f2-4a18-a99f-a14a6b3e8e0d','http://google.com','Default Text',true);

produces:

<a href="http://google.com" rel="72a3dd4f-73f2-4a18-a99f-a14a6b3e8e0d" class="mynaSuggest" target="_blank">Myna Suggestion (which replaced Default Text)</a>

The default text is then replaced by the Myna suggestion when the document has loaded.

Advanced Template Function

This function fetches and returns the Myna Suggestion response for use in PHP. Instead of having JavaScript replace the text, you can fetch it prior to displaying the page—along with having access to the other options in the response. The only arguement is the UUID:

get_myna_var($uuid)

This returns the values for use. As of this plugin version, this response has the following name/value pairs (according to http://mynaweb.com/docs/api.html#suggest):

  • typename: suggestion
  • token: String This is a unique identifier that must be sent back to the server when reward is called
  • choice: String The name of the variant the experiment has chosen

So, for instance:

get_myna_var('72a3dd4f-73f2-4a18-a99f-a14a6b3e8e0d')

will allow you to echo $myna->choice and so on. Please note: this function is for advanced integration, for whatever reason you may have. It will not automatically register the success of your experiment response; you'll need to find a way to send the token back to Myna.

Requirements

  • Myna Account
  • PHP 5
  • Mcrypt

myna-wordpress's People

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.