Integrate Begin AI with WordPress (DIY guide)

Begin AI JavaScript SDK can be easily integrated with WordPress through simple steps, but before getting there, make sure you have an account, team, and schema configured.

Create an Account

💡
Already have an account? Go ahead and access the platform
 
Open https://app.begin.ai/signup and provide your account details
💡
Working with a team? No problem, you can add other team members to your Organization Account following these steps:
💼
Add a New Member to Your Organization

Working with a Team

You can imagine a Team as a way of separating different concepts in Begin’s platform (for example, separating Accounting from Sales data).
When you first join Begin’s platform a default team is created with your organization name. You can add as many Teams as you would like - for more details follow the steps described on
👪
Add a Team
Each Team has its unique APP_ID and LICENSE_KEY - those attributes are used when integrating with any of Begin’s SDK

Adding a Schema

A Schema is a JSON representation of the data attributes that are important for your company, for example, if your intention is to have a restaurant recommendation system perhaps when the restaurant was opened is not an important piece of information.
From your Dashboard, select a Team and then Create A Data Schema
 
notion image
 
You will then be presented with the following page:
notion image
For details on how the Schema structure is defined and the available attributes, visit:
📐
Generate a Schema
💡
You can have as many schemas defined as needed, so don’t worry if your Schema is not fully completed on your first go

Integrate the JavaScript SDK with WordPress

Now that you have a Team and a Schema configured, let's go ahead and install the Begin AI WordPress Plugin

Installing Begin AI WordPress Plugin To Your Instance

On your Admin Panel, navigate to Plugins
notion image
 
Click on the button Add New, on the next page, using the search bar look for begin-ai
notion image
 
Select the option Install Now to have the plugin installed on your instance
We are almost done! Go back to the Plugins page, and Activate the Begin AI plugin
notion image
 
You are good to go!

Using the SDK

Now that the SDK is integrated with your WordPress instance, you are ready to start unlocking the power of Begin’s platform!
Follow the path that is closer to your current structure:
I am currently tracking user interactions on my platform with JavaScript
If you are already using JavaScript to track user interactions (button click, form submit, etc), then those JavaScript files are good places to add Begin’s SDK commands so we can start learning from your data.
The next section will provide more details on how to use the SDK
I am not tracking user interactions on my platform with JavaScript
If you are not tracking user interactions today on your platform, then follow the steps:
  • Create a new *.js file
  • Add it to the Footer section of your application
The next section will provide more details on how to use the SDK
 
Now, that you have identified what’s the best place to add the Begin’s SDK code, let's get to it 🙂
The first step is to create an instance of the BeginWorker object, such as:
const beginWorker = beginai.BeginWorker.instance(APP_ID, LICENSE_KEY)
Code sample of how-to create an instance. Make sure to replace APP_ID and LICENSE_KEY with your ID and key.
Now, that you have an instance of the worker, there are two possible options for the integration:
Manually
You can integrate with the SDK manually by defining the name of the objects/fields that you want to track, the following page contains all the methods available on the SDK for your usage:
💡
Keep in mind that any field defined on the SDK should exist on the Schema. Fields that don’t exist are ignored by the SDK
 
Using the Integration Code from the Dashboard
Head to the Dashboard (https://app.begin.ai), select Integration Code, and navigate to the tab JavaScript, Frontend
notion image
 
Copy the code provided to the correct areas of your application
 
Once you have learned enough about your user interactions, it is time to invoke:
worker.learnFromData();
The method learnFromData applies Begin’s unique instructions to the data stored in the SDK and from there sends the mathematical representation of the data collected to Begin’s Server
💡
We never receive any personal identification information from your platform! All that we will ever know is the mathematical representation
There is no limit to how many times you can invoke learnFromData(), the more we learn about your user interactions and the objects they interact with, the better our model will be!

Adding a Project

You can think of a Project as giving an Objective to the data collected. For details regarding how to create a Project and the possible Objectives, visit
🎬
Create a Project
💡
You can have as many projects as needed for as many different objectives & targets. All the Projects will use the same dataset, just slice it in different ways depending on the desired outcome, for instance, the same dataset can be used to recommend a restaurant and identify fake users.
A Project enables the ability to use the power of the trained models and it's crucial for the full usage of the platform.

Monitoring Projects

For details regarding how to monitor your Project, visit:
👀
Monitoring Projects
💡
Training metrics are only available after your model is trained at least once

Using the trained model

⚠️
This section depends on all the previous sections to be completed before, make sure you haven’t skipped anything 🙂
Now that you have the SDK integrated into your WordPress application and you have configured a Project, it is time to take advantage of the trained model and the full power of AI!
💡
The size of the dataset and the type of project dictate how long it will take for a model to be trained. Don’t worry, you will be notified when the training is done!
Identify what is the best time on your application lifecycle to use Begin’s SDK to provide personalized data to your user, here are a few examples of when you might want to use the integration:
  • If you have a Fake Detection Project, before allowing a user to sign up
  • If you have a Recommendation Project, before displaying the recommended items to your user
    • 💡
      Since Begin AI doesn’t have any information regarding your dataset (think the name of a restaurant or its location), the SDK will provide you with the ID of the items that have a higher similarity to this user's taste. Those IDs will need to be lookup on your own database before presenting the data to your final user
       
Now that you have identified where/when on your lifecycle is the best place to use the personalized information, take a look at the specific details for each method available on the SDK (based on the Project objective selected)
 
Now you know everything that you need to know in order to make the most out of Begin AI!