• The tracking code you sent me works like a dream. To remind you:

    function alx_extras_add_link_ga($url){ $url = str_replace(‘rel=’, ‘onClick=”_trackEvent(\’Affil\’, \’Amazon\’, \’%ASIN%\’);” rel=’, $url); return $url; } add_filter( ‘amazon_link_template_get_link_open’, ‘alx_extras_add_link_ga’, 22, 1 );
    add_filter( ‘amazon_link_template_get_rlink_open’, ‘alx_extras_add_link_ga’, 22, 1 );
    add_filter( ‘amazon_link_template_get_slink_open’, ‘alx_extras_add_link_ga’, 22, 1 );

    I want to put this into the functions.php of a child theme (auto-generated by an ingenious plugin) so it doesn’t get nuked on theme updates but don’t know where to put it… it looks like this:

    <?php
    // Exit if accessed directly
    if ( !defined( ‘ABSPATH’ ) ) exit;

    // BEGIN ENQUEUE PARENT ACTION
    // AUTO GENERATED – Do not modify or remove comment markers above or below:

    if ( !function_exists( ‘chld_thm_cfg_parent_css’ ) ):
    function chld_thm_cfg_parent_css() {
    wp_enqueue_style( ‘chld_thm_cfg_parent’, trailingslashit( get_template_directory_uri() ) . ‘style.css’ );
    }
    endif;
    add_action( ‘wp_enqueue_scripts’, ‘chld_thm_cfg_parent_css’ );

    // END ENQUEUE PARENT ACTION

    Do I just tack it on the end?

    https://www.ads-software.com/plugins/amazon-link/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author paulstuttard

    (@paulstuttard)

    Hi,

    Sorry for the slow reply, been away. Unfortunately I don’t know how child themes work.

    You could stick the code on the end of one of the amazon-link-extra plugins, they don’t tend to update much.

    Or use a simple plugin as a template and give it a new filename and ‘Plugin Name’.

    Paul

    Thread Starter chasman

    (@chasman)

    No probs, thanks for the reply, I’ll give it a go and report back.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Tracking Code’ is closed to new replies.