How to add digital Tracking Tag to one specific collection?

Solved
Jason_Shaw
New Member
2 0 0

Hello,

 

I've successfully added the following tracking tag to my theme.liquid and it works perfectly.  However, I'd really like to begin targeting specific collections within my store.  How do I add this sort of tag to one specific collection?

 

<script type="text/javascript" src="//tag.mydomain.com/autoscript/anotherdomain_aksdfkhasfdhakdjfvfzst/anotherdomain.js"></script>

Thanks, Jason

0 Likes
PaulNewton
Shopify Partner
2588 134 445

This is an accepted solution.

Two options using a property of the collection or alternate templates

 

#1 Use the collection handle or ID

{% if collection.handle == "handle" %}

{% endif %} 

 

#2 Otherwise copy your collection template into an alternate template then in you admin manually assign it to the specific collection

The second way can help lower how often you have to edit code

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
Jason_Shaw
New Member
2 0 0

Thank you!  I'll try that.

0 Likes