all insights/

How to Set Up Analytics and Ads on Your New Website

Set Up Analytics and Ads on Your New Website

Welcome back to our series on preparing publisher websites for a successful migration. In Part 4, we ensured everything was in top shape by conducting a final audit of URLs, content, navigation, and third-party integrations. Today, we’re discussing the analytics and ads setup, which is vital for ensuring your migration meets your business goals. We’ll also discuss how to minimize downtime when flipping the switch.

Read the whole Disaster-Proof Your Migration series here.

Part 5: Setting Up Analytics and Gathering Data

By this stage in our theoretical migration, you’re almost home-free. The content is migrated, the design is perfected, and functionalities are tested. But before you flip the switch, it’s imperative to ensure your analytics and ads settings are configured correctly. Neglecting this step could lead to revenue loss, data gaps, and a lot of unnecessary stress.

Integrate Analytics

Without knowing how users engage with your website, making UX decisions is basically a guessing game. Measuring user behavior, content performance, and earnings requires data pulled into an analytics platform. For most web publishers, that’s using Google Analytics 4 (GA4)

GA4 for WordPress Websites

WordPress makes it relatively easy to add GA4 tracking codes, whether you’re using a theme editor or plugins. Here’s how:

Using the WordPress Theme Editor

If you’re comfortable editing code, you can directly insert the tracking code into your theme.

  1. Log in to Your WordPress Admin Dashboard.
  2. Navigate to Appearance > Theme Editor.
  3. On the right-hand menu, select your header.php file.
  4. Locate the closing </head> tag.
  5. Paste the GA4 tracking code snippet (obtained from your Google Analytics account) right before the closing </head> tag.
  6. Save your changes by clicking Update File.

Be careful:

  • Editing the theme directly may cause the tracking code to be lost if the theme is updated. Use a child theme to prevent this issue.
  • Always always always back up your site before making changes to the code.

Using WordPress Plugins

Plugins are the safer and more user-friendly option for most. They also ensure the code remains intact even if your theme is updated.

Recommended Plugins:

  • Site Kit by Google: Official Google plugin that simplifies connecting GA4 and other Google services like Search Console and Ads.
    • Install the plugin from the Plugins > Add New menu in WordPress.
    • Follow the setup wizard to connect your GA4 property.
    • Site Kit automatically places the tracking code on your site.
  • MonsterInsights: A powerful analytics plugin that integrates with GA4 and provides insights directly within your WordPress dashboard.
    • Install MonsterInsights and configure it to connect your GA4 property using the plugin’s setup wizard.
    • The plugin automatically adds the GA4 tracking code to your site.
  • Insert Headers and Footers: A lightweight plugin for adding code snippets to your site without editing theme files.
    • Install the plugin, then go to Settings > Insert Headers and Footers.
    • Paste the GA4 tracking code snippet in the Header section and save changes.

GA4 for Non-WordPress Websites

If your website isn’t built on WordPress, you can still add the GA4 tracking code using a few methods, depending on your platform.

Custom HTML Websites

  1. Open your website’s HTML files in a code editor.
  2. Locate the closing </head> tag in your template or individual pages.
  3. Paste the GA4 tracking code snippet directly above the </head> tag.
  4. Save and upload the updated files to your server using an FTP client or hosting file manager.
  5. Clear your browser cache and refresh your site to verify the code is active.

Shopify

  1. Log in to your Shopify Admin Dashboard.
  2. Navigate to Online Store > Themes and select your live theme.
  3. Click Actions > Edit Code.
  4. Locate the theme.liquid file in the Layout folder.
  5. Paste the GA4 tracking code just above the closing </head> tag.
  6. Save your changes and preview your site.

GA4 using Google Tag Manager (GTM)

If you’re already using GTM, it’s the most flexible way to manage GA4 tracking and other scripts.

  1. Set up a GTM account and create a container for your WordPress site.
  2. Install the Google Tag Manager for WordPress (GTM4WP) plugin.
  3. Enter your GTM Container ID in the plugin settings.
  4. In GTM, add a new GA4 Configuration tag:
    • Go to Tags > New > Tag Configuration.
    • Select Google Analytics: GA4 Configuration and enter your Measurement ID.
    • Set the trigger to All Pages.
    • Save and publish the container in GTM.

Verify Your Ads are Running Correctly

Ads are a primary revenue source for most publishers. A misstep here can lead to significant revenue downturns.

Update Ad Tags

Ensure that all ad tags are correctly implemented on the new site.

  1. Retrieve Ad Codes: Get the latest ad tags from your Google Ad Manager or ad network.
  2. Place in Correct Locations: Insert the tags into the appropriate sections of your site (header, sidebar, in-content).
  3. Use GTM for Management: Consider using Google Tag Manager to handle your ad tags for easier updates.

Test Ad Serving

After implementing, verify that ads are serving correctly. Here’s how:

  • Use Ad Preview Tools: Google Publisher Console can help you diagnose issues.
  • Check on Multiple Devices: Ensure ads display correctly on desktop, tablet, and mobile.
  • Review Ad Formats: Verify that all ad units (banner, native, video) are working as intended.

Other Solutions

While Google Ads is prevalent, don’t forget other ad solutions like Outbrain, Taboola, or direct-sold campaigns. Here’s a brief summary of how to handle them.

  • Compile a list of all ad networks and partners.
  • Ensure all third-party scripts are updated and functioning.
  • Communicate with ad partners about the migration to preempt any issues.

Ensure Consistency in Ad Inventory

Ideally your ad inventory would remain consistent immediately pre-migration versus immediately post-migration, to ensure that any changes in revenue are clearly contributable to the major tech change and not a config adjustment. Typically we recommend making intentional updates to ad inventory 60 days before or after the point of migration.

Audit Your Ad Placements

Make sure the number and types of ad units are the same as before.

  1. Compare Old and New Sites: Use screenshots or documentation to match ad placements.
  2. Check for Missing Units: Ensure no ad units are omitted or duplicated.
  3. Review Ad Density: Maintain a balance to avoid violating Google’s policies.

Making Changes to Ad Inventory

If you plan to change your ad inventory:

  • Analyze Impact: Understand how changes might affect revenue and user experience.
  • A/B Test: Consider rolling out changes gradually and testing performance.
  • Verify Compliance: Ensure any changes comply with ad policies and regulations.

Bonus: Minimizing Downtime During Migration

Downtime can be detrimental, affecting user experience, ad impressions, and data continuity. Aim for no more than a few minutes of downtime during the switchover.

Migration Timing

Choose a low-traffic period for the final migration steps. Consider:

  • Time Zones: If your audience is global, pinpoint the absolute lowest traffic window.
  • Weekends vs. Weekdays: Depending on your content, weekends might have lower traffic.

Team Coordination

Ensure that all team members are aligned.

  • Create a Detailed Timeline: Outline each step with assigned responsibilities.
  • Communicate the Plan: Keep all stakeholders informed about the migration schedule.
  • Have a Plan B: Have a rollback plan in case something goes wrong.
  • Monitor: Review site performance before, during, and after the migration.
  • Check in: Make your hosting provider aware of the change and ask how they can offer support.

Need Expert Advice?

Migrating your website is a complex endeavor with many moving parts. At Refact, we’ve guided brands like Workweek, HubSpot’s Trends, and Stacked Marketer through successful migrations. If you want to ensure your Ads and Analytics are set up flawlessly, come say hi and let’s make your migration a success.

Read the whole disaster-proofing your migration series here.

Looking to grow your media business?

Get in touch and tell us about your project!

Get in Touch
LET’S WORK TOGETHER

Sound smarter in meetings.

Weekly media tech news in easy-to-read chunks.