How to make Woocommerce and Admitad work together

Describing plugin BG_WP_ADMITAD to connect on-line shop based on WordPress + Woocommerce and Admitad (affiliate program) to get additional traffic to on-line store website. То же самое по-русски.

Admitad offers for on-line stores sites additional traffic with pay per completed purchase.

To create affiliate network it’s necessary to share store contents, organize monitoring attracted user’s actions on the site and record their completed purchases.

That is, it’s necessary to make changes to online shop site codes to:

  1. Dump products and categories to YML (Yandex Markup Language).
  2. Install ReTag codes on relevant pages of the online store.
  3. Set invisible pixel on the thanks for the order page.

All this can be done easily with the help of the plug-BG_WP_ADMITAD.

Plugin is fully compatible with WordPress Multisite.


You have to get plugin file bg_wp_admitad v here, contains documentation zip file and zipped folders /bg_wp_admitad, /bg_wp_retarg and  /bg_ymp_dump.  with plugins, readme, licence files and /languages folder with .pot files to translate messages. Russian translation is also included.

Upload and unzip the those folders to your /wp-content/plugins/ directory.

The last step is to place following code just before the line <!DOCTYPE html> or between </head> and <body> HTML tags

// Check if we are called from admitad
if ( function_exists ( 'get_cpamit_uid' ) ) get_cpamit_uid ();

 This code checks whether a user came by Admitad affiliate network link, if plugin bg_wp_admitad is installed and activated.

How to place the code

  1. All further actions should be performed only in a child theme, otherwise all changes will be lost during next theme update.
  2. Usually, line <!DOCTYPE html> and tags </head> and <body> are located in the theme file header.php that forms the headers of the pages of the site.
  3. If the file header.php does not exist, then make search in the theme folder and find the right file.
  4. Create a secure connection to the server by secure shell (ssh).
  5. Became Superuser
  6. Change to child theme folder for WordPress Multisite:
    cd /chroot/httpd/var/www/wordpress/wp-content/themes/theme_name-child
    or for sigle WordPress site
    cd /chroot/httpd/var/www/wp-content/themes/theme_name-child
  7. Copy the file header.php or another, which contains line <!DOCTYPE html> or “</ head>” tag, to to child theme folder only if this file does not exist there. All the dots in the line below are important.
    cp -p ../theme_name/header.php . 
  8.  Open copied file using vi editor, find line <!DOCTYPE html> or the tag “</ head>” and insert after the above text. Finally, must be as fig.1.
    Woocommerce and Admitad. Fig.1. Added code.

    Fig.1. Added code.

  9. Close ssh connection to the server.

How to make Woocommerce and Admitad work together

Once the plugin is installed, change to the tab “Plugins” online store site (for WordPress Multisite) and one can see three new plugins. They are bg_wp_admitad,  bg_wp_retarg_widget  и bg_yml_dump.  Activate them.

These plugins perform all necessary steps for an online store based on Woocommerce works together with a affiliate network Admitad.

  1. Make settings for the plugin bg_yml_dump (dump the contents of an online store in the format YM), as detailed in post “YML Dump WordPress + Woocommerce on-line shop content“.
  2. Place shortcode [bg-create-pixel] to the first line Thank You for Order Page, just before [woocommerce_thankyou] for Woocommerce 2.0 or to the first line Checkout page just before [woocommerce_checkout] shortcode for Woocommerce 2.2.
  3. Change to “Appearance“->”Widgets” and one can notice new widget BG_Retargetibg_Widget, which parses the pages and, if necessary, inserts a correct redirection codes. Widget is absolutely invisible.
  4. Drag this widget somewhere to the footer, it to appear on each page and fill codes, which are got from Admitad, as fig.2.
    Woocommerce and Admitad. Fig.2. BG_Retargeting Widget

    Fig.2. BG_Retargeting Widget

  5. Tht’s it. The plagin BG_WP_ADMITAD successfully installed and configured. Enjoy your life and cooperation with affiliate network Admitad.

Described plugin BG_WP_ADMITAD to connect on-line shop based on WordPress + Woocommerce and Admitad (affiliate program) to get additional traffic to on-line store website.

, ,

No comments yet.

Leave a Reply