Easy Integration Across Platforms

TargetingMantra is platform agnostic and works on all e-commerce platforms. Our Magento & WooCommerce plugins will help you setup in a few clicks. Our iOS and Android SDK ensure that helps personalize mobile apps.

General Integration

Get entire TargetingMantra Personalization Suite in 3 easy steps

Step 1- Integrating Behavior API.

This will help us track user behavior data (product views, add to carts, purchases etc.) from your website. It's a simple 1x1 tracking pixel and yes, you can drop it using Google Tag Manager.

Languages supported: PHP, Ruby, Python, JavaScript etc.

Step 2: Uploading Catalog Feed

In order to provide the most relevant recommendations, we would require your product/deals/offers catalog. Uploading the catalog is super easy. Just give us the URL to your catalog feed or directly upload your catalog through our platform and sit-back and let us run our magic.

Formats supported: .xml, .csv, .txt, .gz etc.

Step 3: Integrating Widgets

You are one step away from giving your customers a truly personalized experience and increasing your conversion rate. We have over 16 widgets. Our JSON response can be integrated with any UI.

Widget Names: Homepage Best Sellers, Product Page Similar Items, Category Page Ordering etc.

Magento Integration Guide

Step 1: Install Magento extension through Magento Connect

A. Visit TargetingMantra's extension page on Magento Connect and click “Install Now”. After clicking “Install Now” you will see an extension key on the screen. Copy that extension key.

B. Now login to your Magento store admin panel. Go to connect manager by following the path below

Paste the extension key and click “Install” & then click “Proceed”.

C. Now that you've installed our extension, please open the extension's configuration page in your admin panel through the path below.

Click on "Click here to signup" link in that extension page . It will redirect you to our signup page.

Step 2: Configure extension

A. Enter your store URL (http://www.Yourstore.com/), provide your email and choose a password. Once you have signed up you will reach “Getting Started Page”

B. Copy the API Key from the Getting Started Page. Now go back to the magento admin panel and paste the API key in TargetingMantra Configuration page.

TM API Key :
This secret API key should be added in order to activate widgets and trackingpixel.

Enable tracking pixel :
Select 'Yes' from the drop down menu to enable tracking pixel.

Enable Widgets:
Select 'Yes' to enable TargetingMantra widgets. In case, only emails need to be enabled or custom widgets are required, select 'No' from the drop down.

Max products in each widget:
This is the maximum number of products that would be displayed in the recommendations.

Images width:
By default it is 150. For any changes, please inform us.

Images height:
By default it is 150. For any changes, please inform us.

Multiple domains support:
Select 'Yes' in case of multi-store company otherwise select 'No'.

Region:
Region to be used for sending API calls.

Display products having default placeholder image:
Some products in the catalog might have only default placeholder image. If you want to exclude those products from catalog, then select 'No' from the drop down, else select 'Yes'. Excluding the products will result in no recommendations for this product as well since this product won't be shown in any recommendation.

Display products with price 0:
Some products in the catalog might have price 0. If you want to exclude those products from catalog, then select 'No' from the drop down else select 'Yes'. Excluding the products will result in no recommendations for this product as well since this product won't be shown in any recommendation.

C. If you've properly configured our extension, it will automatically upload the catalog, behaviour data and start backend jobs to generate recommendation widgets across all items in store catalog.

Step 3: Launch Widgets

A. Widget Selection: You can switch on/off any of our personalization widgets across all pages at any time through

B. Customize Widgets : With our widget editor you can customize the look and feel of TargetingMantra's widgets by clicking

C. Begin Tracking: Once you have completed all the steps, you will be able to login and view the Dashboard which will give you a detailed insight into Product Page Visits, Products Added to Cart, Products Purchased, Unique Visitors, Average Order Value and Buyer Conversion Ratio.

Frequently Asked Questions

  • How to change the position of widgets manually?
    You can also customize the position of widgets by placing these widget specific div ids manually

    Home Page:

                                    
                                      <!-- New Arrivals -->
                                      <div class="user" id="tm-hp-na"></div>
                                      <!-- Best Sellers Arrivals -->
                                      <div class="user" id="tm-hp-bs"></div>
                                      <!-- Recent history based recommendations -->
                                      <div class="user" id="tm-hp-rhf"></div>
                                      <!-- Recently Viewed Items -->
                                      <div class="user" id="tm-hp-rvi"></div>
                                    
                                  

    Product Page:

                                    
                                      <!-- Who viewed this also viewed -->
                                      <div class="user" id="tm-pp-vsims"></div>
                                      <!-- Who purchased this also purchased -->
                                      <div class="user" id="tm-pp-psims"></div>
                                      <!-- Recent history based recommendations -->
                                      <div class="user" id="tm-pp-rhf"></div>
                                      <!-- Recently Viewed Items -->
                                      <div class="user" id="tm-pp-rvi"></div>
                                    
                                  

    Category Page:

                                    
                                      <!-- Best sellers -->
                                      <div class="user" id="tm-cp-bs"></div>
                                      <!-- New Arrivals -->
                                      <div class="user" id="tm-cp-na"></div>
                                      <!-- Recommendations within category -->
                                      <div class="user" id="tm-cp-cr"></div>
                                    
                                  

    Cart Page:

                                    
                                      <!-- Shopping Cart Suggestions -->
                                      <div class="user" id="tm-ct-csc"></div>
                                    
                                  

    Thank You Page:

                                    
                                      <!-- Post Purchase Recommendation -->
                                      <div class="user" id="tm-tp-ppr"></div>
                                      <!-- Purchase Recommendation -->
                                      <div class="user" id="tm-tp-pr"></div>
                                    
                                  
  • What steps do I need to follow to upgrade extension?

    Just do a standard Magento extension upgrade using Magento connect manager in your store. No other steps are required after upgrade. We would highly recommend you to upgrade our extension periodically to get new feature updates

  • Which Magento versions are supported by TargetingMantra extension?

    Our extension is compatible with 1.7, 1.8, 1.8.1, 1.9 CE editions and also supports 1.8, 1.9, 1.10 Enterprise editions

  • How to uninstall Targetingmantra recommendation suite?

    Follow standard extension uninstallation procedure in Magento connect manager. In any case, we encourage you to send feedback at sales@targetingmantra.com

Shopify Integration Guide

Step 1: Install Shopify extension through Shopify App Store

Visit TargetingMantra's extension page on Shopify App Store and click “Get App”. The app asks for permissions – Click install.

Step 2: Configure extension

On successful installation it will redirect you to ‘TargetingMantra Sign-Up Page. The sign up captures your email-id for further communications.

NOTE If for some reason the installation fails it will redirect you to the ‘error page’. You should then try re-installation.

After you sign-up, you will be able to see the status of your shopify personalization widgets.

Step 3: Launch Widgets

A. Widget Selection: You can switch on/off any of our personalization widgets across all pages at any time through

B. Customize Widgets : With our widget editor you can customize the look and feel of TargetingMantra's widgets by clicking

C. Begin Tracking: Once you have completed all the steps, you will be able to login and view the Dashboard which will give you a detailed insight into Product Page Visits, Products Added to Cart, Products Purchased, Unique Visitors, Average Order Value and Buyer Conversion Ratio.

Frequently Asked Questions

  • How to change the position of widgets manually?
    You can also customize the position of widgets by placing these widget specific div ids manually

    Home Page:

                                        
                                          <!-- New Arrivals -->
                                          <div  id="tm-hp-na"></div>
                                          <!-- Best Sellers Arrivals -->
                                          <div  id="tm-hp-bs"></div>
                                          <!-- Recent history based recommendations -->
                                          <div  id="tm-hp-rhf"></div>
                                          <!-- Recently Viewed Items -->
                                          <div  id="tm-hp-rvi"></div>
                                        
                                      

    Product Page:

                                        
                                          <!-- Who viewed this also viewed -->
                                          <div  id="tm-pp-vsims"></div>
                                          <!-- Who purchased this also purchased -->
                                          <div  id="tm-pp-psims"></div>
                                          <!-- Recent history based recommendations -->
                                          <div  id="tm-pp-rhf"></div>
                                          <!-- Recently Viewed Items -->
                                          <div  id="tm-pp-rvi"></div>
                                        
                                      

    Category Page:

                                        
                                          <!-- Best sellers -->
                                          <div  id="tm-cp-bs"></div>
                                          <!-- New Arrivals -->
                                          <div  id="tm-cp-na"></div>
                                          <!-- Recommendations within category -->
                                          <div  id="tm-cp-cr"></div>
                                        
                                      

    Cart Page:

                                        
                                          <!-- Shopping Cart Suggestions -->
                                          <div  id="tm-ct-csc"></div>
                                        
                                      

    Thank You Page:

                                        
                                          <!-- Post Purchase Recommendation -->
                                          <div  id="tm-tp-ppr"></div>
                                          <!-- Purchase Recommendation -->
                                          <div  id="tm-tp-pr"></div>
                                        
                                      
  • What happens when I change my shop's theme?

    Changing theme erases all the scripts and html elements that we embed in the shop's themes. In such case, reinstallation of the app is highly recommended as the widgets will no longer appear. In case there is some issue while reinstallation, please let us know by sending a mail to support@targetingmantra.com.

  • The widgets are not getting displayed on different pages?

    Ummm... Ideally this should not happen. This mostly happens when a shop changes its theme after installing TargetingMantra App. Changing theme erases all the scripts and html elements that we embed in the shop's themes. In such case, reinstallation of the app is highly recommended as the widgets will no longer appear.

  • Do I see some irrelevant recommendations?

    Well, our recommendation engine would do everything but this. This case generally arises when there is not enough information for some products. For finer tweaking, our tech team can get in touch with the shop owners.

  • What technical challenges can occur?

    Ideally, none. But for our app to work flawlessly, we would like the shop to use newer jQuery versions. There have been cases of very old jQuery version causing some conflict with our scripts. We insist using jQuery version 1.9 or above.

  • How to uninstall Targetingmantra recommendation suite?

    Really? We would not like you to do that, ever. But in case you are dissatisfied with things you can always remove the app from the admin panel, like any other app is removed. And please do not forget to send a feedback to sales@targetingmantra.com

WooCommerce Integration Guide

Step 1: Install WooCommerce extension through Wordpress plugin directory

First step can be done in two ways:

A.1.1 , A.1.2 & A.1.3

OR

A.2.1 and A.2.2

A.1.1 Visit TargetingMantra's extension page on Wordpress Plugin Directory and click “Download”.

A.1.2 Add the downloaded zip file (make sure you don't unzip) of the plugin to

A.1.3. Click on "Install Now" button.

A.2.1 Search for 'TargetingMantra' in search tab.

A.2.2 Click on 'Install Now' button

B. Click on "Activate Plugin" hyperlink.

Step 2: Configure extension

A. Sign-up on the TargetingMantra site . Enter your store URL (http://www.Yourstore.com/), provide your email and choose a password. Once you have signed up you will reach Getting Started page

B. Copy the API Key from the Getting Started page.

C. Now go to the TargetingMantra settings tab on Wordpress admin panel
Following are the required settings-
  • Paste the API key in ­Secret Key text­box
  • Check the text­box to ­enable TargetingMantra widgets
  • Set the value of the number of widgets to be displayed (the value is 8 by default)
  • Select the action name to be used for displaying widgets on shop, category, product, cart and thank you page.This is used to change the positioning of our widgets on your site.
NOTE: We are using the actions provided by WooCommerce to insert our widgets.If those actions are missing or you need to display widgets on some position other than the suggested ones, then select the 'none' action from dropdown and add the following empty divs at the location where you want to display the widgets.
Home Page-
<div id=tm-hp-na></div><div id=tm-hp-bs></div><div id=tm-hp-rhf></div><div id=tm-hp-rvi></div>
Category page-
<div id=tm-cp-na></div><div id=tm-cp-bs></div> <div id=tm-cp-cr></div>
Product page-
<div id=tm-pp-psims></div><div id=tm-pp-vsims></div><div id=tm-pp-rhf></div><div id=tm-pp-rvi></div>
Cart page-
<div id=tm-ct-csc></div>
Thank you page-
<div id=tm-tp-ppr></div>

D. If you have properly configured our extension, it will automatically upload the catalog, and start back­end jobs to generate recommendation widgets across all items in the store catalog.

Step 3: Launch Widgets

A. Widget Selection: You can switch on/off any of our personalization widgets across all pages at any time through

B. Customize Widgets : With our widget editor you can customize the look and feel of TargetingMantra's widgets by clicking

C. Begin Tracking: Once you have completed all the steps, you will be able to login and view the Dashboard which will give you a detailed insight into Product Page Visits, Products Added to Cart, Products Purchased, Unique Visitors, Average Order Value and Buyer Conversion Ratio.

Android SDK

Download SDK

TargetingMantra Android SDK primarily has two API end points:

  • 1. PushEvents- This is used to record events such as clicks, purchases, add to carts, like etc.
  • 2. GetWidgetData- This functionality is used to get TM widgets such as new arrivals, best sellers, recently viewed items etc.

Getting Started

Step 1: Dependencies

Add the following dependencies in your gradle file:

Code
compile 'com.android.support:support-v4:21.0.0' compile 'com.google.android.gms:play-services:6.5.87' compile 'com.google.code.gson:gson:1.7.2' compile 'comi.nostra13.universalimageloader:universal-image-loader:1.8.6' compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2' compile 'com.squareup:tape:1.2.3'

Step 2: Permissions

Add the following permission to your AndroidManifest.xml. Your manifest file should look like this:

Code
uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"
uses-permission android:name="android.permission.READ_PHONE_STATE"
uses-permission android:name="android.permission.INTERNET"
uses-permission android:name="android.permission.GET_ACCOUNTS android:maxSdkVersion="4"
uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"
uses-permission android:name="android.permission.WAKE_LOCK"
uses-permission android:name="android.permission.VIBRATE"
uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"
permission android:name="#APPLICATION_PACKAGE#.permission.C2D_MESSAGE" android:protectionLevel="signature"
uses-permission android:name="#APPLICATION_PACKAGE#.permission.C2D_MESSAGE"

Step 3: Receivers and Services

Add receivers and services to AndroidManifest.xml.

Code
receiver android:name="com.tm.sdk.notifications.receivers.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND"
intent-filter
action android:name="com.google.android.c2dm.intent.RECEIVE"
category android:name="#APPLICATION_PACKAGE#"
intent-filter
intent-filter
action android:name="com.google.android.c2dm.intent.REGISTRATION"
intent-filter
receiver
receiver android:name="com.tm.sdk.notifications.receivers.EventReceiver"
intent-filter
action android:name="OPEN"
action android:name="DELETE"
intent-filter
receiver
receiver android:name="com.tm.sdk.notifications.receivers.AlarmReceiver"
intent-filter
category android:name="alarm"
action android:name="start_location_service"
intent-filter
receiver
service android:name="com.tm.sdk.notifications.services.RegistrationService"
service android:name="com.tm.sdk.notifications.services.LocationService"
service android:name="com.tm.sdk.notifications.services.EventPushService"
service android:name="com.tm.sdk.notifications.services.NotificationService"
service android:name="com.tm.sdk.services.DataPushService"

NOTE #APPLICATION_PACKAGE# should be replaced by your Application Package.

Step 4: Initialization

For initialization, use the following code at the entry of your app:

Code
Map map = new HashMap(); map.put(Widget.HOME_PAGE_BEST_SELLERS, "Best Sellers"); TargetingMantra.init(this, 12345, “asia”, “Rs”, map); ImagLoaderUtility.init(this);

There are 2 types of widget containers viz. Carousel and Accordian. They can be used in the layout xml like this:

Code
com.tm.sdk.views.CarouselContainer android:id="@+id/cView" android:layout_width="match_parent" android:layout_height="match_parent"
com.tm.sdk.views.AccordianView android:id="@+id/aView" android:layout_width="match_parent" android:layout_height="match_parent"

Pushing Behaviour Data

Step 1: Creating Record Request

Creating record event requests:

Home Page
Code
RecordEventNetworkRequest hpRecordEventNetworkRequest = new RecordEventNetworkRequest() .new Builder() .setEvent(Event.CLICK) .setPageId("homepage") .build()
Category Page
Code
RecordEventNetworkRequest cpRecordEventNetworkRequest = new RecordEventNetworkRequest() .new Builder() .setEvent(Event.CLICK) .setCategoryId("22") .build()
Product Page
Code
RecordEventNetworkRequest productPageRecordEventNetworkRequest = new RecordEventNetworkRequest() .new Builder() .setEvent(Event.CLICK) .setProductId("756") .setPrice("67.00") .build()
Cart Page
Code
RecordEventNetworkRequest cartPageRecordEventNetworkRequest = new RecordEventNetworkRequest() .new Builder() .setEvent(Event.ADD_TO_CART) .setProductId("756") .build()
Post Purchase Page
Code
RecordEventNetworkRequest purchasePageRecordEventNetworkRequest = new RecordEventNetworkRequest() .new Builder() .setEvent(Event.PURCHASE) .setProductId("756") .build()

Step 2: Send Record Requests

For recording events and widget calls, customer id is optional and can be set using:

For recording events, use TargetingMantra.getInstance().recordEvent(recordEventNetworkRequest).

Widget Integration

1. Make references to widget container views
CarouselContainer cView = (CarouselContainer) this.findViewById(R.id.cView); AccordianView aView = (AccordianView) this.findViewById(R.id.aView);

Step 1: Creating Resource Maps

1. Create view resource maps like this:
Code
WidgetViewResourceMap widgetViewResourceMap = new WidgetViewResourceMap() .new Builder() .setWidgetNameRes(com.tm.sdk.R.id.widgetTitleView) .setLayoutRes(com.tm.sdk.R.layout.widget_title) .build(); ItemViewResourceMap itemViewResourceMap = new ItemViewResourceMap() .new Builder() .setLayoutRes(com.tm.sdk.R.layout.carousel_item) .setItemTitleRes(com.tm.sdk.R.id.itemNameView) .setItemImageRes(com.tm.sdk.R.id.itemImageView) .setItemPriceRes(com.tm.sdk.R.id.itemPriceView) .build();

Step 2: Initializing Views

1. Call init method on views
Code
cView.init(widgetViewResourceMap, itemViewResourceMap, new ItemClickCallback() { @Override public void onClick(TMItem tmItem) { //switch to product screen } });

Step 3: Creating Page Request

Following are the examples of page network requests for different pages:

Home Page
Code
PageNetworkRequest homePageNetworkRequest = new PageNetworkRequest() . new Builder() .setPage(Page.HOME_PAGE) .build()
Category Page
Code
PageNetworkRequest categoryPageNetworkRequest = new PageNetworkRequest() . new Builder() .setPage(Page.CATEGORY_PAGE) .setCategoryId("44") .build()
Cart Page
Code
PageNetworkRequest cartPageNetworkRequest = new PageNetworkRequest(). new Builder() .setPage(Page.CART_PAGE) .setExplicitSources("78,90") .build()
Product Page
Code
PageNetworkRequest productPageNetworkRequest = new PageNetworkRequest(). new Builder() .setPage(Page.PRODUCT_PAGE) .setProductId("384") .build()
Thank You Page
Code
PageNetworkRequest tyPageNetworkRequest = new PageNetworkRequest(). new Builder() .setPage(Page.THANKYOU_PAGE) .setExplicitSources("78,90") .build()

Step 4: Show Page Widgets

Following is the code for showing page widgets:

Code
TargetingMantra.getIntstance().showWidgets(cView, pageNetworkRequest, new WidgetCallback() { @Override public void onSuccess() { // widgets successfully shown } @Override public void onFailure(Throwable e) { // problem in showing widgets } });

Step 5: Creating Widget Requests

Following are the examples for creating widget requests for different pages

Home Page Widgets
Code
WidgetNetworkRequest homeWidgetNetworkRequest = new WidgetNetworkRequest() .new Builder() .setWidgets(new Widget[] {Widget.HOME*}) .build()
Category Page Widgets
Code
WidgetNetworkRequest categoryWidgetNetworkRequest = new WidgetNetworkRequest() .new Builder() .setWidgets(new Widget[] {Widget.CATEGORY*}) .setCategoryId(“47”) .build()
Product Page Widgets
Code
WidgetNetworkRequest productWidgetNetworkRequest = new WidgetNetworkRequest() .new Builder() .setWidgets(new Widget[] {Widget.PRODUCT*}) .setProductId(“124”) .build()
Other Page Widgets (For other type of widgets like THANK_YOU_POST_PURCHASE_RECOMMENDATIONS, etc)
Code
WidgetNetworkRequest productWidgetNetworkRequest = new WidgetNetworkRequest() .new Builder() .setWidgets(new Widget[] {/*OTHER/*}) .setExplicitSources(“67,89”) .build()
Step 6: Show Widget Collections

Following is the code for showing widgets:

Code
TargetingMantra.getIntstance().showWidgets(cView, widgetNetworkRequest, new WidgetCallback() { @Override public void onSuccess() // widgets successfully shown } @Override public void onFailure(Throwable e) { // problem in showing widgets } });

NOTE For recording events and widget calls, customer id is optional and can be set using:

builder.setCustomerId(“als78”)

where builder is the builder for NetworkRequest.

NOTE: For displaying custom widgets, use the following method calls:

TargetingMantra.getIntstance().getWidgets(widgetNetworkRequest, new WidgetRequestCallback() { @Override public void onSuccess(TMWidgetResponse widgetResponse) { } @Override public void onFailure(Throwable throwable) { } }); TargetingMantra.getIntstance().getPage(pageNetworkRequest, new WidgetRequestCallback() { @Override public void onSuccess(TMWidgetResponse widgetResponse) { } @Override public void onFailure(Throwable throwable) { } });

Notification Support

Step 1: Registration

For registering for Notification support, use the following method call.

NotificationRegistrar.getInstance().register(context, icon, activity)

where context is application context, icon is the value of the resource you want to use as notification icon and activity is Class, i.e., the activity you want to switch to when notification gets clicked. When this activity is opened, custom data that you have sent will be there in intent extras, the key for which will be “data”. In case icon is null, default app icon will be used.

iOS SDK

You can integrate with our iOS SDK using the following three simple steps once you have signed up with us and downloaded the SDK.

1. Add the SDK as dependency to your application.

2. Set the merchant id while application is being loaded by making a simple function call.

3. In different views of your application send us the behavior data and ask for recommendations by calling two simple functions.