Table of Contents▼
Introduction
Google Tag Manager (GTM) is the industry standard for managing analytics and marketing tags on your website. When integrated with Hikari, you gain a powerful combination: GTM's flexible tag management paired with Hikari's intuitive analytics dashboard.
This comprehensive guide walks you through the entire integration process, from initial setup to advanced troubleshooting. By the end, you'll have a fully functional analytics implementation that captures the data you need.
Prerequisites
Before starting, ensure you have:
- A Hikari account (sign up free if you don't have one)
- A Google Tag Manager account with a container set up
- Admin access to your website's code or CMS
- Basic understanding of HTML and JavaScript (helpful but not required)
What You'll Need
| Item | Where to Find It |
|---|---|
| GTM Container ID | GTM Admin > Container Settings |
| Hikari Tracking ID | Hikari Dashboard > Settings > Tracking |
| Website Access | Your CMS or hosting provider |
Step 1: Create a GTM Account and Container
If you already have a GTM account, skip to Step 2.
1.1 Sign Up for GTM
- Navigate to Google Tag Manager
- Sign in with your Google account
- Click Create Account

1.2 Set Up Your Container
- Enter your Account Name (typically your company name)
- Enter your Container Name (use your website domain)
- Select Web as the target platform
- Click Create
1.3 Accept Terms of Service
Review and accept the GTM Terms of Service. Your container is now ready.
Step 2: Install the GTM Code on Your Website
2.1 Get Your GTM Code
- Open your GTM container
- Click on your container ID (format: GTM-XXXXXXX)
- A modal will appear with two code snippets

2.2 Add Code to Your Website
Option A: Direct HTML Installation
Add the following code as high as possible in the <head> of your website:
Add this code immediately after the opening <body> tag:
Important: Replace GTM-XXXXXXX with your actual container ID.
Option B: CMS-Specific Installation
| CMS | Installation Method |
|---|---|
| WordPress | Use a plugin like "GTM4WP" or add to theme's header.php |
| Shopify | Add to theme.liquid file in the Layouts folder |
| Webflow | Add to Custom Code in Site Settings |
| Squarespace | Use Code Injection in Advanced Settings |
| Next.js | Create a GTM component and include in _app.tsx |
2.3 Verify Installation
Use the GTM Preview mode or a browser extension like "Tag Assistant" to verify your installation:
- Open GTM and click Preview
- Enter your website URL
- Look for "Tag Manager connected" message

Step 3: Connect GTM to Hikari
3.1 Get Your Hikari Tracking ID
- Log in to your Hikari dashboard
- Navigate to Settings > Tracking
- Copy your Tracking ID (format: HKR-XXXXXXXX)
![]()
3.2 Create the Hikari Tag in GTM
- In GTM, go to Tags > New
- Name your tag: "Hikari - Page View"
- Click Tag Configuration
- Select Custom HTML

3.3 Add the Hikari Tracking Code
Paste this code into the HTML field:
Replace YOUR_TRACKING_ID with your actual Hikari tracking ID.
3.4 Set Up the Trigger
- Scroll down to Triggering
- Click the pencil icon or Add Trigger
- Select All Pages
- Click Save

3.5 Save and Publish
- Click Save to save your tag
- Click Submit in the top right
- Enter a version name (e.g., "Initial Hikari Setup")
- Click Publish
Step 4: Configure Event Tracking
Basic page views are just the beginning. Let's set up event tracking to capture meaningful user interactions.
4.1 Track Button Clicks
Create a Click Trigger:
- Go to Triggers > New
- Name it: "Click - CTA Buttons"
- Trigger Type: Click - All Elements
- This trigger fires on: Some Clicks
- Condition:
Click TextcontainsSign Up(or your CTA text) - Save
Create the Event Tag:
- Go to Tags > New
- Name: "Hikari - Event - CTA Click"
- Tag Type: Custom HTML
- HTML:
- Trigger: Select "Click - CTA Buttons"
- Save and publish
4.2 Track Form Submissions
Create a Form Trigger:
- Go to Triggers > New
- Name: "Form - Contact Form"
- Trigger Type: Form Submission
- This trigger fires on: Some Forms
- Condition:
Form IDequalscontact-form(adjust to your form ID) - Check "Wait for Tags" and set timeout to 2000ms
- Save
Create the Form Event Tag:
4.3 Track Scroll Depth
Create a Scroll Trigger:
- Go to Triggers > New
- Name: "Scroll - 50%"
- Trigger Type: Scroll Depth
- Check Vertical Scroll Depths
- Select Percentages: 50
- Save
Create the Scroll Tag:
Step 5: Set Up Data Layer Variables
The data layer is GTM's way of passing information between your website and tags. Here's how to set up useful variables.
5.1 Create Data Layer Variables
- Go to Variables > User-Defined Variables > New
- Configure these common variables:
| Variable Name | Variable Type | Data Layer Variable Name |
|---|---|---|
| Page Category | Data Layer Variable | pageCategory |
| User ID | Data Layer Variable | userId |
| Product Price | Data Layer Variable | productPrice |
| Transaction ID | Data Layer Variable | transactionId |
5.2 Push Data to the Data Layer
Add this code to your website where relevant:
Step 6: Verify Your Setup
6.1 Use GTM Preview Mode
- Click Preview in GTM
- Enter your website URL
- Interact with your site (click buttons, submit forms, scroll)
- Verify that tags fire correctly

6.2 Check Hikari Dashboard
- Open your Hikari dashboard
- Navigate to Real-time > Events
- Perform actions on your website
- Verify events appear within seconds
6.3 Use Browser DevTools
Open Chrome DevTools (F12) and check:
- Network tab: Look for requests to
hikari.io - Console tab: Check for any JavaScript errors
- Application tab: Verify cookies are being set
Troubleshooting Common Issues
Tags Not Firing
Symptoms: No data appearing in Hikari dashboard
Solutions:
- Check trigger conditions: Ensure your triggers match the actual page elements
- Verify tag firing: Use GTM Preview to see if tags are triggered
- Check data layer: Ensure data layer variables are populated before tags fire
Duplicate Events
Symptoms: Same event recorded multiple times
Solutions:
- Check for multiple GTM containers on the page
- Ensure tags aren't duplicated in GTM
- Verify trigger conditions aren't too broad
Missing Data in Variables
Symptoms: Variables show undefined in GTM Preview
Solutions:
- Check data layer variable names match exactly (case-sensitive)
- Ensure data is pushed before the tag fires
- Use
gtm.loadevent for late-loaded data
GTM Blocking Page Load
Symptoms: Slow page performance after GTM installation
Solutions:
- Use async loading for all tags
- Limit the number of tags firing on page load
- Consider using Tag Sequencing for non-critical tags
Advanced Configuration
E-commerce Tracking
For e-commerce sites, implement enhanced tracking:
User Identification
Track users across sessions:
Custom Dimensions
Pass custom data for segmentation:
Best Practices
- Use a naming convention:
category_action_label(e.g.,cta_click_header) - Document your tags: Keep a spreadsheet of all tags, triggers, and variables
- Test in a staging environment: Never test new tags in production
- Use workspaces: Create separate workspaces for major changes
- Version control: Name your versions descriptively
- Regular audits: Review tags quarterly to remove unused ones
Conclusion
You now have a fully functional GTM integration with Hikari. This setup provides a solid foundation for tracking user behavior and measuring marketing performance.
Remember to:
- Test thoroughly before publishing changes
- Document your implementation
- Review your data regularly
- Keep your tags organized
Need help? Check out our documentation or contact support.


