Tracking Google Ads Conversions Using Wix Custom Code

3 min read
You can use Google Ads conversion tracking to measure the conversion actions that users take on your Wix site after they click or view your Google ads. For example, a visitor might reach a purchase confirmation page on your site after clicking an ad. 
After you create your conversion action in Google Ads, you can track it by adding a snippet of custom code in your site's dashboard. 
Tip:
Before you begin:
  • You need to connect Google Tag Manager to your site before you can set up conversion tracking.
  • By using this service, you are engaging directly with a third-party service provider. We recommend reviewing the service provider's Privacy Policy and Terms of Use prior to your use of such third-party service. You acknowledge that we are not liable for any loss or damage resulting from your use of such third-party service, including any liability arising from any personal data exchanged between you and such third-party.

Step 1 | Create a conversion action

First, you need to create a conversion action in your Google Ads account. This gives you the Conversion ID and Label ID that you need to use in your custom code snippet to track the action.

To create a conversion action:

  1. Sign in to your Google Ads account
  2. (If you're using Smart Mode) Click the Tools & Settings icon select Switch to Expert Mode.
    Note: After you make this switch, you won't be able to switch back to Smart Mode. 
  3. Click Tools & Settings at the top.
  4. Select Conversions under Measurement in the drop-down menu.
Selecting conversions from the Tools and Settings menu in Google Ads
  1. Click New conversion action.
  2. Select Website
  3. Enter your website domain.
  4. Click Scan.
  5. Scroll down to Create conversion actions manually using code.
  6. Click Add a conversion manually.
  7. Select the type of conversion action to track from the Goal and action optimization drop-down menu.
  8. Enter a name for the conversion action in the Conversion name field.
Creating a conversion in Google Ads
  1. Select Use different values for each conversion in the Value section.
    Note: You don't need to change the default value.
  2. Click Done
  3. Click Save and continue.
  4. Select the Use Google Tag Manager tab.
  5. Make a note of the Conversion ID and Conversion Label ID.
Getting your Conversion ID and Conversion Label ID

Step 2 | Set up tracking using custom code

After you've created your conversion action, you can start tracking it by embedding a snippet of custom code on your site.

To set up custom code:

  1. Copy the following code snippet into a text editor. 
1<script>
2function registerListener() {
3    window.wixDevelopersAnalytics.register('conversionListener', (e, p) => {
4        if (e === 'Purchase') {
5            gtag('event', 'conversion', {
6                'send_to': 'AW-CONVERSION_ID/LABEL_ID',
7                'value': p.revenue,
8                'currency': p.currency,
9                'transaction_id': p.orderId
10            });
11        }
12    });
13}
14window.wixDevelopersAnalytics ? registerListener() : window.addEventListener('wixDevelopersAnalyticsReady', registerListener);
15</script>
  1. Find the send_to line in the code.
  2. Replace the placeholder values with your values:
    • AW-CONVERSION_ID: Your Conversion ID from Google Ads
    • LABEL_ID: Your Label ID from Google Ads
  3. Copy the entire code snippet.
  4. Go to Custom Code in your site's dashboard.
  5. Click + Add Custom Code at the top right.
  6. Paste the code snippet in the text box. 
  7. Enter a name for your code.
    Tip: Give it a name that is easy to recognize so you can quickly identify it later. 
  8. Select an option under Add Code to Pages:
    • All pages: This adds the code to all of your site's pages, including any new pages that you create in the future. Choose whether to load the code only once per visit, or on each page your visitor opens.
    • Choose specific pages: Use the drop-down menu to select the relevant pages.
  9. Choose where to place your code under Place Code in:.
    • Head
    • Body - start
    • Body - end
  10. Click Apply.
  11. Go to Marketing Integrations in your site's dashboard.
  12. Click Connect under Google Ads.
  13. Click Add Google Ads Tag.
  14. Add your conversion ID.
  15. Click Save.

Did this help?

|