sarahvko Posted February 16, 2020 Share Posted February 16, 2020 Site URL: https://violin-dove-sdn3.squarespace.com/ Hi! I'm trying to add a smart app banner to the homepage of our website and I've used the following code and injected it into the header code injection section: <script> var meta = document.createElement('meta'); meta.name = 'apple-itunes-app'; meta.content = 'app-id=1434995457'; document.getElementsByTagName('head')[0].appendChild(meta); </script> If you have any idea why this isn't working, I would really appreciate your help! Thanks 🙂 Link to comment
Isaac_ Posted July 27, 2020 Share Posted July 27, 2020 Hi @sarahvko! I ran into the same issue and found a resolution. First, I used this code, which is similar to what you had above: <script> var meta = document.createElement('meta'); meta.name = 'apple-itunes-app'; meta.content = 'app-id=XXX, affiliate-data=YYY'; document.getElementsByTagName('head')[0].appendChild(meta); </script> If you don't plan to add any affiliate data, just delete the3 Y's below and ensure the line of code ends with the semicolon, like this: meta.content = 'app-id=XXX, affiliate-data='; Next, replace the 3 X's for app-id with your app ID, which is a string of numbers (you can find your app ID in the App Store link maker tool here. If you were adding an iMovie app banner, the meta.content line would read like this: meta.content = 'app-id=377298193, affiliate-data='; In this example, your entire code block should look like this: <script> var meta = document.createElement('meta'); meta.name = 'apple-itunes-app'; meta.content = 'app-id=377298193, affiliate-data='; document.getElementsByTagName('head')[0].appendChild(meta); </script> Finally, I injected the Javascript into the header like this: After hitting Save, ensure the iPhone you're testing-with doesn't have iMovie (in this case, or the app associated with the App ID you used in your Javascript) installed on the device, then visit the URL of the page you just added the Javascript above to, to test. The final key for me – and this is critical – is you visit the URL from Safari, but NOT in Private Browsing mode. Good luck! 👊 Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.