Title: Tracking Code
Last modified: August 30, 2016

---

# Tracking Code

 *  [chasman](https://wordpress.org/support/users/chasman/)
 * (@chasman)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/tracking-code-7/)
 * 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://wordpress.org/plugins/amazon-link/](https://wordpress.org/plugins/amazon-link/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [paulstuttard](https://wordpress.org/support/users/paulstuttard/)
 * (@paulstuttard)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/tracking-code-7/#post-6620844)
 * 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](https://wordpress.org/support/users/chasman/)
 * (@chasman)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/tracking-code-7/#post-6620845)
 * 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.

 * ![](https://s.w.org/plugins/geopattern-icon/amazon-link_070606.svg)
 * [Amazon Link](https://wordpress.org/plugins/amazon-link/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amazon-link/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amazon-link/)
 * [Active Topics](https://wordpress.org/support/plugin/amazon-link/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amazon-link/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amazon-link/reviews/)

## Tags

 * [child theme](https://wordpress.org/support/topic-tag/child-theme/)

 * 2 replies
 * 2 participants
 * Last reply from: [chasman](https://wordpress.org/support/users/chasman/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/tracking-code-7/#post-6620845)
 * Status: not resolved