{"id":29273664,"url":"https://github.com/simplifi/tag_mangement_examples","last_synced_at":"2026-02-02T21:10:45.857Z","repository":{"id":66706945,"uuid":"72794476","full_name":"simplifi/tag_mangement_examples","owner":"simplifi","description":null,"archived":false,"fork":false,"pushed_at":"2016-11-18T16:58:35.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-07-05T03:14:27.642Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simplifi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-11-03T23:02:39.000Z","updated_at":"2020-09-04T04:39:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"f65c400e-32b3-4e38-8971-49dd64f45a44","html_url":"https://github.com/simplifi/tag_mangement_examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/simplifi/tag_mangement_examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplifi%2Ftag_mangement_examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplifi%2Ftag_mangement_examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplifi%2Ftag_mangement_examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplifi%2Ftag_mangement_examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplifi","download_url":"https://codeload.github.com/simplifi/tag_mangement_examples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplifi%2Ftag_mangement_examples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29019708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T18:51:31.335Z","status":"ssl_error","status_checked_at":"2026-02-02T18:49:20.777Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-05T02:36:31.572Z","updated_at":"2026-02-02T21:10:45.850Z","avatar_url":"https://github.com/simplifi.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Tag Management Examples\n\n## Basic Tag Placement\nLet's assume you have been given a tag like the following:\n\n```\n\u003cscript async src='https://tag.simpli.fi/sifitag/945669a0-3942-4027-bff6-27e1cdca28cc'\u003e\u003c/script\u003e\n```\n\nPlease note that the long GUID after /sifitag/ will be different in your case.  Typically this tag should be placed at the bottom of every page in your website before the body tag, like so:\n\n```\n  \u003c!-- other html content would go here and above --\u003e\n\n    \u003c!-- Simpli.fi global tag: ---\u003e\n    \u003cscript async src='https://tag.simpli.fi/sifitag/945669a0-3942-4027-bff6-27e1cdca28cc'\u003e\u003c/script\u003e\n\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Container Tags and Iframes\n\nSimpli.fi does not recommend the use of \"container tags\" or placing tags inside a separate page which is called through an iframe. Doing this means that the simpli.fi tag will have no built-in way of knowing which page our tag is actually placed on, so the Tag Management rules in the Simpli.fi UI will not work.  The only URLs we will see are those of the iframe.  If you must use a container tag, a workaround would be to use the \"referer\" query string parameter in the tag, replacing the sample referer with the one that the iframe tag is placed on:\n\n\n```\n\u003cscript async src='https://tag.simpli.fi/sifitag/945669a0-3942-4027-bff6-27e1cdca28cc?referer=http://yourdomain.com/page-the-iframe-is-on'\u003e\u003c/script\u003e\n\n```\n\nThis will tell simpli.fi what page the container tag is placed on, so that you can create rules on how to handle the tage on those pages. \n\nIdeally, you would not hard code urls into the referer parameter, but instead use some sort of server-side programming logic to pass the URL of the page into the iframe and then to the container tag.  For example, if you were using Ruby on Rails on your website, and your container tag iframe page is at the URL \"/container\", you could dynamically pass the root URL of the outermost page, into the iframe, and then into the simpli.fi tracking tag:\n\nOn the outermost page with the \"real\" url or in a layout or template:\n\n```\n\u003c!-- some other content would be here --\u003e\n\n\u003ciframe src=\"/container?referer=\u003c%= request.original_url%\u003e\" /\u003e\n```\n\nThen on the container page with the simpli.fi tag on it:\n\n```\n\u003cscript async src='https://tag.simpli.fi/sifitag/945669a0-3942-4027-bff6-27e1cdca28cc?referer=\u003c%= params[\"referer\"] %\u003e'\u003e\u003c/script\u003e\n```\n\nA similar mechanism could be used for any web programming language such as PHP, ASP.NET, JSP, etc.  \n\n## Javascript Buttons and other Events\n\nSometimes, you will want to trigger a segment or conversion not if the user browses to a specific page or url, but instead when they perform some action on the page.  This might open a dialog, pop open a new section, or completely change the content of the page without changing the url.  In these cases, one must combine the referer parameter with a bit of javascript to \"trick\" the Simpli.fi tag into thinking its on a new URL when it is not.\n\nLet's say we want to put someone in a segment when the user views their shopping cart, but the shopping cart only opens a dialog window.  One could create a \"fake\" url representing the shopping cart event. \n\n```\n\u003cscript language=\"javascript\"\u003e\nfunction viewCart() {\n\t//code to view the cart would go here.\n}\n\u003c/script\u003e\n\n\u003c!--- Link or button to view the cart ---\u003e\n\u003ca href=\"#\" onclick=\"viewCart();\"\u003eView My Cart\u003c/a\u003e\n```\n\nWe would modify this code to drop the simpli.fi tag programmatically using javascript, with a fake URL representing that the user visited their shopping cart:\n\n\t\nThis is a variation of this stackoverflow.com article:\nhttp://stackoverflow.com/questions/5235321/how-do-i-load-a-javascript-file-dynamically\n\n```\n\u003cscript language=\"javascript\"\u003e\nfunction viewCart() {\n\t//code to view the cart would go here.\n\n\t\n   // DOM: Create the script element\n   var jsElm = document.createElement(\"script\");\n   // set the type attribute\n   jsElm.type = \"application/javascript\";\n   // make the script element load the Simpli.fi tracking tag\n   jsElm.src = \"https://tag.simpli.fi/sifitag/945669a0-3942-4027-bff6-27e1cdca28cc?referer=http://example.com/view-shopping-cart\";\n   // finally insert the element to the body element in order to load the script\n   document.body.appendChild(jsElm);\n}\n\u003c/script\u003e\n\n\u003c!--- Link or button to view the cart ---\u003e\n\u003ca href=\"#\" onclick=\"viewCart();\"\u003eView My Cart\u003c/a\u003e\n```\n\nNote that while the referer does have to have proper URL syntax it doesn't actually have to a be a real URL on your website.  Its simply there to label the tracking event has occurred.  We do require that you use the real domain name of your website rather than a fake one, so none of your URLs collide with another client's URLs.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplifi%2Ftag_mangement_examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplifi%2Ftag_mangement_examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplifi%2Ftag_mangement_examples/lists"}