Amazon Advertising Install / Embed Tag or SDK | OpsBlu Docs

Amazon Advertising Install / Embed Tag or SDK

Deployment methods for Amazon Ads pixels, attribution tags, and SDK implementations across web and mobile.

Deployment Strategy

Google Tag Manager, Adobe Launch, or Tealium provide the most flexible deployment approach for Amazon Advertising tags.

  • Benefits: Version control, testing environments, conditional firing, centralized management
  • Requirements: GTM container installed on site, appropriate user permissions
  • Best For: Organizations with multiple marketing tags and frequent updates

Direct JavaScript Embed

Hard-coded pixel implementation directly in website HTML or JavaScript files.

  • Benefits: No dependency on tag management systems, faster initial page load
  • Drawbacks: Requires developer resources for updates, limited testing flexibility
  • Best For: Simple implementations, static websites, or when GTM is not available

Server-Side Implementation

Amazon Ads Conversions API for server-to-server event tracking.

  • Benefits: Browser-independent, not affected by ad blockers, enhanced data security
  • Requirements: Backend development resources, secure API credential management
  • Best For: High-value conversions, subscription services, mobile app conversions

Tag Manager Deployment

Google Tag Manager Implementation

Step 1: Create Amazon Ads Tag

  1. Navigate to GTM workspace and select "New Tag"
  2. Choose "Custom HTML" tag type
  3. Paste Amazon Ads pixel code provided in Amazon Ads console
  4. Name tag descriptively (e.g., "Amazon Ads - Conversion Pixel - Purchase")

Step 2: Configure Tag Firing

  1. Create trigger for conversion event (e.g., "Trigger - Purchase Confirmation")
  2. Set trigger type based on event:
    • Page View: Specific page URLs (e.g., /thank-you, /order-confirmation)
    • Custom Event: Data layer events (e.g., dataLayer.push({'event': 'purchase'}))
  3. Add trigger conditions to prevent duplicate fires
  4. Test trigger in GTM Preview mode

Step 3: Pass Dynamic Values

Create GTM variables to pass transaction data to Amazon pixel:

<script>
!function(e,n,t,o,c,r){e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},
e[o].l=1*new Date,r=n.createElement(t),r.async=1,
r.src="https://s.amazon-adsystem.com/iu3/conversion/{{Amazon Advertiser ID}}.js",
n.head.appendChild(r)}(window,document,"script","aw");

aw('conversion', {
  currency: '{{DLV - Currency}}',
  value: {{DLV - Transaction Value}},
  transactionId: '{{DLV - Order ID}}'
});
</script>

Variables to create:

  • DLV - Currency: Data Layer Variable for transaction currency
  • DLV - Transaction Value: Data Layer Variable for revenue
  • DLV - Order ID: Data Layer Variable for unique order identifier

Step 4: Environment-Specific Configuration

Use GTM Environment variables to deploy different pixel IDs across environments:

  1. Create GTM Variable "Amazon Advertiser ID"
  2. Set type to "Lookup Table"
  3. Configure inputs:
    • Input: {{Page Hostname}}
    • If hostname contains "dev" → Output: Development Pixel ID
    • If hostname contains "staging" → Output: Staging Pixel ID
    • Default → Output: Production Pixel ID

Adobe Launch Implementation

  1. Create new Rule for conversion event
  2. Add Amazon Ads Custom Code action
  3. Configure data elements for dynamic parameters
  4. Set rule conditions and event triggers
  5. Validate in Launch debugger before publishing

Tealium Implementation

  1. Add Amazon Ads tag template from Tag Marketplace
  2. Map Tealium data layer to Amazon pixel parameters
  3. Configure load rules for conversion pages
  4. Set up QA environment for testing
  5. Publish to production after validation

Direct Embed or Hard-Coded Scripts

Base Pixel Implementation

Place the following code in the <head> section of all pages:

<!-- Amazon Ads Base Pixel -->
<script>
!function(e,n,t,o,c,r){e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},
e[o].l=1*new Date,r=n.createElement(t),r.async=1,
r.src="https://s.amazon-adsystem.com/iu3/conversion/YOUR_ADVERTISER_ID.js",
n.head.appendChild(r)}(window,document,"script","aw");
</script>

Replace YOUR_ADVERTISER_ID with your actual Amazon Advertising account ID.

Conversion Event Tracking

On conversion pages (e.g., purchase confirmation), add:

<script>
aw('conversion', {
  currency: 'USD',
  value: 49.99,
  transactionId: 'ORDER-12345'
});
</script>

Environment-Aware Implementation

Use server-side rendering to inject environment-specific pixel IDs:

<script>
var amazonAdvertiserId = '<%= ENV['AMAZON_ADS_ID'] %>';
// Then use amazonAdvertiserId variable in pixel code
</script>

Mobile & App SDKs

iOS Implementation

Installation via CocoaPods

Add to Podfile:

pod 'AmazonAdSDK'

Run pod install

Initialize SDK

In AppDelegate:

import AmazonAdSDK

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    AmazonAds.shared.initialize(advertiserId: "YOUR_ADVERTISER_ID")
    return true
}

Track Conversion Events

AmazonAds.shared.trackConversion(
    eventType: "purchase",
    value: 49.99,
    currency: "USD",
    transactionId: "ORDER-12345"
)

Android Implementation

Gradle Dependency

Add to app/build.gradle:

dependencies {
    implementation 'com.amazon.advertising:amazon-ads-sdk:1.0.0'
}

Initialize SDK

In Application class or MainActivity:

import com.amazon.ads.AmazonAds;

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        AmazonAds.initialize(this, "YOUR_ADVERTISER_ID");
    }
}

Track Events

AmazonAds.trackConversion("purchase", 49.99, "USD", "ORDER-12345");

Mobile Testing

  • Use Amazon Ads SDK test mode during development
  • Verify events in Amazon Ads console under "Conversions" dashboard (12-24 hour delay)
  • Test on both iOS and Android physical devices
  • Validate events across different app versions

Server-Side Collection

Amazon Ads Conversion API

For server-side conversion tracking, use HTTP POST to Amazon's endpoint:

curl -X POST https://advertising-api.amazon.com/conversion \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
  "advertiserId": "YOUR_ADVERTISER_ID",
  "conversionType": "purchase",
  "value": 49.99,
  "currency": "USD",
  "transactionId": "ORDER-12345",
  "timestamp": "2025-12-24T10:30:00Z",
  "clickId": "CLICK_ID_FROM_URL"
}'

Event Deduplication

To prevent duplicate tracking between client and server:

  1. Generate unique event ID on client side
  2. Store event ID in data layer and send with both client and server events
  3. Amazon will deduplicate based on transactionId and timestamp
  4. Implement 5-minute window for deduplication matching

Error Handling

import requests

def track_amazon_conversion(event_data):
    try:
        response = requests.post(
            'https://advertising-api.amazon.com/conversion',
            headers={
                'Authorization': f'Bearer {access_token}',
                'Content-Type': 'application/json'
            },
            json=event_data,
            timeout=5
        )

        if response.status_code == 200:
            log_success(event_data)
        else:
            log_error(response.status_code, response.text)
            queue_for_retry(event_data)
    except Exception as e:
        log_exception(e)
        queue_for_retry(event_data)

Validation Checklist

Tag Firing Verification

  • Amazon pixel script loads on target pages (check Network tab for amazon-adsystem.com requests)
  • Conversion events fire on expected user actions
  • No JavaScript console errors related to Amazon tags
  • Pixel fires only once per page load (no duplicates)

Parameter Validation

  • Transaction value passes correctly (numeric, not string)
  • Currency code is valid ISO 4217 format (e.g., USD, EUR, GBP)
  • Transaction ID is unique for each conversion
  • Product data includes required fields for product ads

Cross-Environment Testing

  • Test tags in development, staging, and production environments
  • Verify correct pixel IDs for each environment
  • Validate that test purchases use test credentials/pixel IDs
  • Confirm production data does not pollute test environments

Performance Validation

  • Measure page load time impact (should be under 100ms)
  • Verify asynchronous loading does not block page rendering
  • Test tag behavior with slow network connections
  • Validate mobile performance on 3G/4G networks

Configuration Recommendations

Audience Pixels: Enable Amazon Audience pixels for retargeting if you run Sponsored Display or DSP campaigns. Place the audience pixel on high-intent pages (product pages, cart, category pages) to build retargeting segments. Audience pixels are separate from conversion pixels — you need both.

Attribution Windows: Amazon's default is 14-day click attribution. For products with longer consideration cycles (electronics, furniture, B2B), consider extending to 28 days if available in your campaign type. Viewthrough attribution is available for DSP campaigns only (1-day default).

Product Catalog Sync: For dynamic product ads, sync your product catalog through Amazon's feed specifications. Update the feed daily via S3 upload or API. Ensure product IDs in your conversion tags match catalog IDs exactly for accurate ROAS reporting.

Amazon Attribution: Add Amazon Attribution tags alongside your standard conversion pixels if you drive external traffic to Amazon product pages. This measures how off-Amazon marketing channels (Google, Facebook, email) drive Amazon sales. Generate attribution tags in Amazon Attribution console and deploy via GTM.

Consent Integration: Wrap Amazon tag initialization in your consent check for EU/UK audiences. Amazon tags set cookies — load them only after marketing consent is granted. For US audiences, no consent gating is required under current regulations.