How To Implement GA4 Tracking Via JSON Files

Over the course of the last year, we have seen several changes when it comes to our privacy online including how we view this data and how it can be used to remarket to users. Adding Covid-19 to the mix, we as marketers have had no choice but to change our thinking and the way we implement our paid media and PPC strategies.

As if all these tweaks weren’t enough, Google kindly threw GA4 into the mix… something that is very different to what we have seen before. One of the most challenging aspects of GA4 is tracking. Whilst there is hope in the marketing community that Google will make GA4 more user-friendly when it exits Beta mode, we need to find a more convenient way to implement eCommerce tracking in the meantime. If you are someone who uses plug-ins, I have good news for you! Many plug-ins have created JSON files to make implementing said tracking far, far easier!

Why Is eCommerce Tracking On GA4 So Difficult?

When it comes to setting up tracking on Universal Analytics, Google has a handy little check box on the Google Analytics settings or the tag that says “I would like you to read the information from our data layer” as set out below:

Or:

Unfortunately, GA4 does not have these check boxes. But what does this mean?

As we know the data Layer holds all the information on the website; Transaction ID, number of purchases, total purchase value. This information is pulled into tag manager who then pushes that information into which ever data base we are using, i.e. Google Analytics, Google Ads and Facebook.

The enable enhanced eCommerce features check boxes provides Google Tag Manager permission to grab these values manually, this means that eCommerce tracking can be set up by anyone and no coding knowledge is needed.

Sounds easy right? It was until GA4 came along!

How Do We Set Up GA4 eCommerce Tracking Without A JSON File?

When it comes to GA4, you need be able to pull information manually from the data Layer which will need some basic knowledge of coding. The following image showcases what a Data Layer will look like:

In Tag Manager, you need to raise a data Layer variable and write the Data Layer variable exactly how the information is in the data layer.

For example, if you wanted to pull the information from this Data Layer information you would need to create a data layer variable to pull item data. The Data Layer variable needs to encapsulate the following:

Next, under the GA4 tag you need to add an event parameter and data Layer variable for each bit of information you need i.e., Item ID, purchase value, transaction ID.

To make the situation more complicated, website developers and various plug-ins often have their way to write a code. This means that there is no one-size-fits-all code, and you will need to carry out a ‘test transaction’ before tracking can begin just to read the code. You must then write the code and carry out a further test transaction to ensure the code works correctly. If not, you may need to update the code and complete the above process again. Sound exhausting, right?!

The good news is a lot of plug-ins have seen this as an issue and come up with a resolution. Some plug-ins will automatically track these events for you such as Pixel Your Site. Other plugins such as WordPress for Tag Manager have created JSON files.

What Is A JSON file & How Do I Use It?

In this scenario, I’m going to use WordPress for Tag Manager as it’s the one that I have successfully tested and found works well.

A JSON file is a container where the plug-in writes the code for you in a JSON file based on how they write the Data Layers. All you need to do is change the information in the JSON file based on your Tag Manager information, upload it into Google Tag Manager and Voila – your tracking is all set up ready for you to test!

The instructions are below:

1) Download the JSON file

Plug-ins will either provide you the JSON file on their website or through the plug-in settings. For WordPress (Tag Manager), you can find this on the website under step one called ‘GA4 container template’.

2) Change the information on the JSON file

Once downloaded, you can open this on note pad. The file itself is pretty big, so I have not included the full file in this blog but an example snippet instead:

What you need to do is replace all the 00000’s with the IDs in Tag Manager. As this information runs all the way through the file, it’s likely to be more efficient to use the find function in notepad.

3) Upload into tag manager

Once the relevant information has been changed, go to Tag Manager, and select the admin column. Under the container section you will see a section called import container:

Simply select the choose container file and upload. You have the option of uploading into the existing workspace or a new one.

4) Check and test

Once the file has been uploaded, you can check all the tags have been added correctly with the right information. If everything is good to go, publish your changes and test that the new tags are working correctly. It really is as easy as 1, 2, 3!

Conclusion

Unless you have extensive code knowledge or a website department with unlimited resources, I strongly recommend using plugins and JSON files. As someone who put a lot of time and energy into working out how to set up eCommerce tracking, this is a massive time saver! If you are currently using a plug-in, check to see what they offer. Some plug ins may incur a fee whilst others are free – be sure to shop around to find the best one for you. Just be aware that, should you update a plug, your tracking may experience some temporary disruption.

 

For more information, get in touch with Absolute Digital Media’s expert paid media/PPC team on 0800 088 6000 today.

For more information or to discuss your own digital marketing requirements, call one of our expert team today on 0800 088 6000.

Tiffany Shears
Tiffany Shears
PPC Manager

Tiffany started off working in the complaints department of a digital masters company whilst completing her dissertation in Law. It was here she learnt about all the different forms of read more.

Our Digital Marketing News

Mavericks And Mischief Makers: The Disruptor’s Guide To Marketing

Last week our Marketing Manager, Jasmine McKenzie, attended the Mavericks and Mischief Makers: The disruptor’s guide to marketing in Leicester Square, London, during which time she had the opportunity to

Happy Business Women’s Day! How We’re Empowering Women In The Workplace

Thursday 22nd September marks Business Women’s Day, something we at Absolute are always keen to celebrate. As an award-winning digital marketing agency, we continually strive to do better and empowering

How To Choose The Right Digital Agency

Whether you’re on the lookout for your first marketing agency to promote your business or are seeking a specialised digital marketing agency to fast-track your growth, there are a few

Start Now!

Join The Leading Digital Marketing Agency

Fill out the form to take the first step to digital success! Our digital marketing agency consultants are always on hand to hear from new businesses and answer any questions you may have. Select the services you're interested in and add any additional information about your digital marketing goals below, and we'll get back to you as soon as possible.

    • Goal
    • Service
    • Industry
    • Budget
    • Info

    What is your goal?

    I want to drive more leadsI want to earn more online salesI want to improve my ROII want to improve brand awareness

    What service are you looking for?

    SEOPPCDigital PRLink BuildingOther (Marketplaces, Paid social...)

    What industry you are in?

    What is your monthly budget?

    £2,000 - £5,000£5,000 - £10,000£10,000 - £20,000£20,000+ We are currently using an agencyLooking for an agency ImmediatelyWithin 1-2 monthsWithin 3-6 monthsIn 6+ months time

    Please provide us with your contact details
    so we can fulfil your enquiry.


    Subscribe me to the latest digital marketing updates and promotional information

    X
    Hey!
    Don’t go just yet…
    Arrange your free, non-obligatory consultation today!

      During the call with one of our experts you’ll have the opportunity to discuss:
      • Your marketing pain points and challenges
      • What you want to achieve as part of your wider strategy
      • How we can work together to enhance your marketing efforts
      • The other services are available to you